lumo icon indicating copy to clipboard operation
lumo copied to clipboard

lumo global installation permission failure

Open kanaka opened this issue 6 years ago • 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

> [email protected] 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! [email protected] install: `node scripts/npm_install.js || nodejs scripts/npm_install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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 [email protected]
1687 info lifecycle [email protected]~install: [email protected]
1688 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle false
1689 verbose lifecycle [email protected]~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 [email protected]~install: CWD: /usr/lib/node_modules/lumo-cljs
1691 silly lifecycle [email protected]~install: Args: [ '-c',
1691 silly lifecycle   'node scripts/npm_install.js || nodejs scripts/npm_install.js' ]
1692 silly lifecycle [email protected]~install: Returned: code: 1  signal: null
1693 info lifecycle [email protected]~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: [email protected] 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 [email protected]
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 [email protected] install: `node scripts/npm_install.js || nodejs scripts/npm_install.js`
1704 error Exit status 1
1705 error Failed at the [email protected] 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 .

kanaka avatar Jul 14 '17 13:07 kanaka

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 avatar Aug 23 '17 00:08 sonwh98

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

anmonteiro avatar Aug 23 '17 00:08 anmonteiro

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

sonwh98 avatar Aug 23 '17 00:08 sonwh98

Seems like was added to docs here? https://github.com/anmonteiro/lumo/commit/b579ec759bce53276a7fd7f91bc2bb88c6326e09#diff-96693bbf67804ebab0d4b0137c80458f

alex-dixon avatar Jan 14 '18 16:01 alex-dixon