New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polymer-cli global install error #2502

Closed
guss77 opened this Issue Aug 3, 2017 · 30 comments

Comments

Projects
None yet
@guss77
Copy link

guss77 commented Aug 3, 2017

Description

npm error when running npm install -g polymer-cli as root.

This is done in CI process in a Docker container.

Versions & Environment

  • Polymer CLI: 1.3.1
  • node: 8.2.1
  • npm: 5.3.0
  • Operating System: Debian 8

Steps to Reproduce

To reproduce, build this Dockerfile:

FROM node
RUN npm install -y polymer-cli

Expected Results

NPM should install polymer-cli without an error.

Actual Results

We get an error in the output and the installation exists with error code 1:

> wd@1.4.0 install /usr/local/lib/node_modules/polymer-cli/node_modules/wd
> node scripts/build-browser-scripts

/usr/local/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:90
                    throw err0;
                    ^

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/polymer-cli/node_modules/wd/build'
    at Object.fs.mkdirSync (fs.js:891:18)
    at sync (/usr/local/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:71:13)
    at Object.<anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/wd/scripts/build-browser-scripts.js:6:1)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
npm info lifecycle wd@1.4.0~install: Failed to exec install script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wd@1.4.0 install: `node scripts/build-browser-scripts`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the wd@1.4.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-08-02T04_53_27_270Z-debug.log

The log file mentioned in the output says:

...
24890 silly install wd@1.4.0
24891 info lifecycle wd@1.4.0~install: wd@1.4.0
24892 verbose lifecycle wd@1.4.0~install: unsafe-perm in lifecycle false
24893 verbose lifecycle wd@1.4.0~install: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/usr/local/lib/node_modules/polymer-cli/node_modules/wd/node_modules/.bin:/usr/local/lib/node_modules/polymer-cli/node_modules/.bin:/usr/local/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
24894 verbose lifecycle wd@1.4.0~install: CWD: /usr/local/lib/node_modules/polymer-cli/node_modules/wd
24895 silly lifecycle wd@1.4.0~install: Args: [ '-c', 'node scripts/build-browser-scripts' ]
24896 silly lifecycle wd@1.4.0~install: Returned: code: 1  signal: null
24897 info lifecycle wd@1.4.0~install: Failed to exec install script
24898 verbose unlock done using /root/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
24899 verbose stack Error: wd@1.4.0 install: `node scripts/build-browser-scripts`
24899 verbose stack Exit status 1
24899 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:289:16)
24899 verbose stack     at emitTwo (events.js:125:13)
24899 verbose stack     at EventEmitter.emit (events.js:213:7)
24899 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
24899 verbose stack     at emitTwo (events.js:125:13)
24899 verbose stack     at ChildProcess.emit (events.js:213:7)
24899 verbose stack     at maybeClose (internal/child_process.js:921:16)
24899 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
24900 verbose pkgid wd@1.4.0
24901 verbose cwd /
24902 verbose Linux 4.10.0-29-generic
24903 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "polymer-cli@next"
24904 verbose node v8.2.1
24905 verbose npm  v5.3.0
24906 error code ELIFECYCLE
24907 error errno 1
24908 error wd@1.4.0 install: `node scripts/build-browser-scripts`
24908 error Exit status 1
24909 error Failed at the wd@1.4.0 install script.
24909 error This is probably not a problem with npm. There is likely additional logging output above.
24910 verbose exit [ 1, true ]

Workarounds:

Using node:6 as the base image, works out fine.

@jarrodek

This comment has been minimized.

Copy link
Contributor

jarrodek commented Aug 3, 2017

I have the same error on MacOS.

npm -v: 5.3.0
node -v: v8.2.1

Error message:

npm WARN deprecated bower@1.8.0: ..psst! While Bower is maintained, we recommend Yarn and Webpack for new front-end projects! Yarn's advantage is security and reliability, and Webpack's is support for both CommonJS and AMD projects. Currently there's no migration path, but please help to create it: bower/bower#2467
npm WARN deprecated @types/assert@0.0.29: See DefinitelyTyped/DefinitelyTyped#12826
/usr/local/bin/polymer -> /usr/local/lib/node_modules/polymer-cli/bin/polymer.js

wd@1.4.0 install /usr/local/lib/node_modules/polymer-cli/node_modules/wd
node scripts/build-browser-scripts

/usr/local/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:90
throw err0;
^

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/polymer-cli/node_modules/wd/build'
at Object.fs.mkdirSync (fs.js:891:18)
at sync (/usr/local/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:71:13)
at Object. (/usr/local/lib/node_modules/polymer-cli/node_modules/wd/scripts/build-browser-scripts.js:6:1)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wd@1.4.0 install: node scripts/build-browser-scripts
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wd@1.4.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/pawelpsztyc/.npm/_logs/2017-08-03T23_47_06_896Z-debug.log

@femiadeyemi

This comment has been minimized.

Copy link

femiadeyemi commented Aug 4, 2017

This issue is also report here https://github.com/Polymer/polymer-cli/issues/832. Can any of the admins check this? Thanks.

@guss77

This comment has been minimized.

Copy link
Author

guss77 commented Aug 4, 2017

As details in the NPM issue linked above, the problem is a regression in NPM and can be also worked around by setting --unsafe-perm

@jarrodek

This comment has been minimized.

Copy link
Contributor

jarrodek commented Aug 4, 2017

Wired thing. After I posted my comment I wen't back home. Today I was able to install the cli tool globally without this option. Only thing I did is restart... Another Mac issue then?

@guss77

This comment has been minimized.

Copy link
Author

guss77 commented Aug 4, 2017

A. With or with out sudo?
B. What is your npm version?
C. What does npm config get prefix say?

@TimvdLippe

This comment has been minimized.

Copy link
Contributor

TimvdLippe commented Sep 19, 2017

@TimvdLippe TimvdLippe closed this Sep 19, 2017

@HaginCodes

This comment has been minimized.

Copy link

HaginCodes commented Oct 14, 2017

I recently ran into this issue and what I can say that fixes it is to do sudo npm install -g polymer-cli --unsafe-perm

@gimite

This comment has been minimized.

Copy link

gimite commented Nov 23, 2017

I also encountered this issue with the latest npm (5.5.1) and was workarounded by adding --unsafe-perm option as instructed above. Has anyone reported this issue to npm, if it is an issue of npm?

@awenate

This comment has been minimized.

Copy link

awenate commented Jan 11, 2018

Running sudo npm install -g polymer-cli --unsafe-perm also worked for me. Running node 8.9.4 and npm 5.6.0.

@morrisr808

This comment has been minimized.

Copy link

morrisr808 commented Feb 3, 2018

Redic, just troubleshooted the same error. Can you guys (any packages makers), include a setup and getting started guide that works. How can we move forward if every step needs troubleshooting?

@twinforces

This comment has been minimized.

Copy link

twinforces commented Feb 23, 2018

+1 Same thing here. Luckily Google found the error message.

@louismanson

This comment has been minimized.

Copy link

louismanson commented Apr 10, 2018

sudo npm install -g polymer-cli --unsafe-perm works fine for me to, Running npm: 5.6.0 and
node: 8.11.1

@jairbj

This comment has been minimized.

Copy link

jairbj commented Apr 12, 2018

sudo npm install -g polymer-cli --unsafe-perm also worked for me.
npm: 5.6.0
node: 9.10.1

@ravi-reglobe

This comment has been minimized.

Copy link

ravi-reglobe commented Apr 14, 2018

I have the same problem. and I solved by changing npm's Default Directory.
then by running following command without sudo and --unsafe-perm
npm install -g polymer-cli

this is not the issue with polymer-cli, but of node and npm installation location.

@SakuraComputing

This comment has been minimized.

Copy link

SakuraComputing commented Jun 5, 2018

sudo npm install -g polymer-cli --unsafe-perm also worked for me.
npm: 5.6.0
node: 8.11.2

@jhonedisongomez

This comment has been minimized.

Copy link

jhonedisongomez commented Jun 7, 2018

thanks

@EndersonPro

This comment has been minimized.

Copy link

EndersonPro commented Jun 13, 2018

sudo npm install -g polymer-cli --unsafe-perm also worked for me.
npm: 6.1.0
node: 10.4.1

@bmargula

This comment has been minimized.

Copy link

bmargula commented Jul 6, 2018

Had the same problem installing polymer-cli on a linux hosted agent in VSTS. --unsafe-perm worked for me. Thanks for the workaround.

@SSGavas

This comment has been minimized.

Copy link

SSGavas commented Jul 9, 2018

--unsafe-perm worked for me. Thanks for the workaround.

@hack2root

This comment has been minimized.

Copy link

hack2root commented Jul 13, 2018

why I ever need to do --unsafe-perm on My latest Sierra? It it not so smart as it seems or MacOS support is finally dropped for node/npm developers?

@aaroncadillac

This comment has been minimized.

Copy link

aaroncadillac commented Jul 18, 2018

@hack2root you could use nvm ;) and you have all the permissons on the world to make polymer works

@a854363956

This comment has been minimized.

Copy link

a854363956 commented Jul 29, 2018

sudo npm install -g polymer-cli --unsafe-perm also worked for me.
npm: 6.2.0
node: v8.11.3

@anneb

This comment has been minimized.

Copy link

anneb commented Aug 6, 2018

Same error, fixed with:
sudo npm install -g polymer-cli --unsafe-perm
npm: 6.2.0
node: v8.0.0
Ubuntu 16.04.5 LTS

@andylamax

This comment has been minimized.

Copy link

andylamax commented Aug 8, 2018

--unsafe-perm worked for me too

@me89

This comment has been minimized.

Copy link

me89 commented Oct 11, 2018

Why is it closed? This issue is still in Polymer 3...

The workaround works with --unsafe-perm worked for me as well.
MacOs 10.14
Node 10.8.0
NPM 6.2.0

@jsilvermist

This comment has been minimized.

Copy link
Contributor

jsilvermist commented Oct 11, 2018

Because this isn't a problem with the polymer-cli, it's caused by permission problems with your npm setup. You can either manually configure permissions after installing npm, or use something like nvm which will do it automatically.

@guss77

This comment has been minimized.

Copy link
Author

guss77 commented Oct 11, 2018

You can either manually configure permissions after installing npm, or use something like nvm which will do it automatically.

Or - better yet, fix the problem in NPM itself, as documented here: npm/npm#17346 . Though by the fact that that bug report is "archived", there's a good indication that NPM maintainers don't intend to fix this problem and consider it "purposefully broken".

Maybe someone would like to open a new bug report about this problem, I personally am no longer invested in the nodejs community, a lot because of attitudes demonstrated in the above linked NPM issue #17346, which is complete indifference to incorrect behavior that does not impact the developer own personal workstation.

@guss77

This comment has been minimized.

Copy link
Author

guss77 commented Oct 11, 2018

You can either manually configure permissions after installing npm, or use something like nvm which will do it automatically.

Or - better yet, fix the problem in NPM itself, as documented here: npm/npm#17346 .

Though by the fact that the npm/npm repository is archived (with thousands of bugs still open), with development moved (unexplained) to another Github repository with no bug tracking - and developers are now expected to file bugs through a Discourse forum posting - all this is a good indication that NPM maintainers aren't really interested in fixing this and other bugs.

Maybe someone would like to re-report this bug here: https://npm.community/c/bugs.

I personally am no longer invested in the nodejs community, a lot because of attitudes demonstrated in the process described here: which is complete indifference to incorrect behavior that does not impact the developer own personal workstation (relegating bug reports to forum posts is basically saying that they don't care about bug reports).

@femiadeyemi

This comment has been minimized.

Copy link

femiadeyemi commented Dec 18, 2018

This seem to be the best solution (don't use this on production machine):
https://github.com/Polymer/polymer-cli/issues/828#issuecomment-319842742

@Atom-Hydra-7

This comment has been minimized.

Copy link

Atom-Hydra-7 commented Dec 21, 2018

The same error I also suffered in Windows 8.1 x86 32-bit.

@aomarks aomarks transferred this issue from Polymer/polymer-cli Jan 3, 2019

@aomarks aomarks added the Package: cli label Jan 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment