tools: polymer-cli global install error
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.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 35 (4 by maintainers)
I recently ran into this issue and what I can say that fixes it is to do
sudo npm install -g polymer-cli --unsafe-permAs details in the NPM issue linked above, the problem is a regression in NPM and can be also worked around by setting
--unsafe-permRunning
sudo npm install -g polymer-cli --unsafe-permalso worked for me. Running node 8.9.4 and npm 5.6.0.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?
I have the same error on MacOS.
npm -v: 5.3.0 node -v: v8.2.1
Error message:
Had the same problem installing polymer-cli on a linux hosted agent in VSTS.
--unsafe-permworked for me. Thanks for the workaround.