anmonteiro/lumo

lumo global installation permission failure

kanaka opened this issue ยท 4 comments

npm install -g lumo-cljs seems to fail if run as root (either using sudo or run directly as root).

For example, I'm trying to build a docker container with lumo installed globally and get the following error:

# npm install -g lumo-cljs
/usr/bin/lumo -> /usr/lib/node_modules/lumo-cljs/bin/lumo.js

> lumo-cljs@1.6.0 install /usr/lib/node_modules/lumo-cljs
> node scripts/npm_install.js || nodejs scripts/npm_install.js

internal/streams/legacy.js:59
      throw er; // Unhandled stream error in pipe.
      ^

Error: EACCES: permission denied, open 'lumo_linux64.zip'
internal/streams/legacy.js:59
      throw er; // Unhandled stream error in pipe.
      ^

Error: EACCES: permission denied, open 'lumo_linux64.zip'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lumo-cljs@1.6.0 install: `node scripts/npm_install.js || nodejs scripts/npm_install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the lumo-cljs@1.6.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-07-14T13_03_12_933Z-debug.log

The end of the log file is this:

1686 silly install lumo-cljs@1.6.0
1687 info lifecycle lumo-cljs@1.6.0~install: lumo-cljs@1.6.0
1688 verbose lifecycle lumo-cljs@1.6.0~install: unsafe-perm in lifecycle false
1689 verbose lifecycle lumo-cljs@1.6.0~install: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/usr/lib/node_modules/lumo-cljs/node_modules/.bin:/usr/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
1690 verbose lifecycle lumo-cljs@1.6.0~install: CWD: /usr/lib/node_modules/lumo-cljs
1691 silly lifecycle lumo-cljs@1.6.0~install: Args: [ '-c',
1691 silly lifecycle   'node scripts/npm_install.js || nodejs scripts/npm_install.js' ]
1692 silly lifecycle lumo-cljs@1.6.0~install: Returned: code: 1  signal: null
1693 info lifecycle lumo-cljs@1.6.0~install: Failed to exec install script
1694 verbose unlock done using /root/.npm/_locks/staging-a072192f34a17023.lock for /usr/lib/node_modules/.staging
1695 verbose stack Error: lumo-cljs@1.6.0 install: `node scripts/npm_install.js || nodejs scripts/npm_install.js`
1695 verbose stack Exit status 1
1695 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
1695 verbose stack     at emitTwo (events.js:125:13)
1695 verbose stack     at EventEmitter.emit (events.js:213:7)
1695 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
1695 verbose stack     at emitTwo (events.js:125:13)
1695 verbose stack     at ChildProcess.emit (events.js:213:7)
1695 verbose stack     at maybeClose (internal/child_process.js:897:16)
1695 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
1696 verbose pkgid lumo-cljs@1.6.0
1697 verbose cwd /mal
1698 verbose Linux 4.4.0-43-generic
1699 verbose argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "lumo-cljs"
1700 verbose node v8.1.4
1701 verbose npm  v5.0.3
1702 error code ELIFECYCLE
1703 error errno 1
1704 error lumo-cljs@1.6.0 install: `node scripts/npm_install.js || nodejs scripts/npm_install.js`
1704 error Exit status 1
1705 error Failed at the lumo-cljs@1.6.0 install script.
1705 error This is probably not a problem with npm. There is likely additional logging output above.
1706 verbose exit [ 1, true ]

I think this started failing with newer versions of node/npm but I'm not certain. My suspicion is that the npm_install.js script is trying to download the lumo_linux64.zip package to a location where npm no longer allows writing to (or perhaps the default directory changed in npm at some point). Writing the zip file to an actual temp directory (when on Linux) might solve the issue.

If you have docker you should be able to easily replicate the issue with the following simple Dockerfile:

FROM ubuntu:xenial

RUN apt-get -y update && apt-get -y install curl

# Add nodesource apt repo config for 8.X
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -

RUN apt-get -y install nodejs
RUN npm install -g lumo-cljs

Then run docker build -t lumo-test .

This issue has been marked as closed but i'm getting the exact problem. What is the fix? I'm using npm 5.3.0 on ubuntu 16.04

@sonwh98 I think the current fix is to npm install -g lumo-cljs --unsafe-perm

great! that fixed it! maybe update the doc to reflect this? thanks for the fast response!
\

Seems like was added to docs here?
b579ec7#diff-96693bbf67804ebab0d4b0137c80458f