elm-platform icon indicating copy to clipboard operation
elm-platform copied to clipboard

Fail of npm install -g elm on linux systems.

Open eprparadocs opened this issue 6 years ago • 7 comments

I get a failure when using npm install on my linux system. I get the ELIFECYCLE error. I've retried it on two different linux systems with the same outcome.

eprparadocs avatar Apr 23 '18 23:04 eprparadocs

I'm not able to install as well, using sudo npm install -g elm

 [34] → sudo npm install -g elm
npm WARN deprecated [email protected]: Use uuid module instead
/usr/bin/elm -> /usr/lib/node_modules/elm/binwrappers/elm
/usr/bin/elm-make -> /usr/lib/node_modules/elm/binwrappers/elm-make
/usr/bin/elm-package -> /usr/lib/node_modules/elm/binwrappers/elm-package
/usr/bin/elm-repl -> /usr/lib/node_modules/elm/binwrappers/elm-repl
/usr/bin/elm-reactor -> /usr/lib/node_modules/elm/binwrappers/elm-reactor

> [email protected] install /usr/lib/node_modules/elm
> node install.js

Error extracting linux-x64.tar.gz - Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/elm/Elm-Platform'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node 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!     /home/me/.npm/_logs/2018-05-05T16_04_25_674Z-debug.log

On Ubuntu 16.04. edit: also using npm 6.0.0 node 8.11.1

cornjuliox avatar May 05 '18 16:05 cornjuliox

Changing the default npm directory as listed here (https://docs.npmjs.com/getting-started/fixing-npm-permissions) and trying again gets me an ELIFECYCLE error

[74] → npm install -g elm
npm WARN deprecated [email protected]: Use uuid module instead
/home/enricojr/.npm-global/bin/elm -> /home/enricojr/.npm-global/lib/node_modules/elm/binwrappers/elm
/home/enricojr/.npm-global/bin/elm-make -> /home/enricojr/.npm-global/lib/node_modules/elm/binwrappers/elm-make
/home/enricojr/.npm-global/bin/elm-package -> /home/enricojr/.npm-global/lib/node_modules/elm/binwrappers/elm-package
/home/enricojr/.npm-global/bin/elm-reactor -> /home/enricojr/.npm-global/lib/node_modules/elm/binwrappers/elm-reactor
/home/enricojr/.npm-global/bin/elm-repl -> /home/enricojr/.npm-global/lib/node_modules/elm/binwrappers/elm-repl

> [email protected] install /home/enricojr/.npm-global/lib/node_modules/elm
> node install.js

Downloading Elm binaries from https://dl.bintray.com/elmlang/elm-platform/0.18.0/linux-x64.tar.gz
Error decompressing linux-x64.tar.gz Error: unexpected end of file
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node 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!     /home/enricojr/.npm/_logs/2018-05-06T09_35_42_628Z-debug.log

Strangely , it seems to have installed properly anyways. ~/.npm-global has contents in it, elm and elm-package seem to work from the command line, and which elm / which elm-package both return /home/enricojr/.npm_global/bin/ as a result.

I'm not entirely sure what's happened.

cornjuliox avatar May 06 '18 10:05 cornjuliox

I'm not an npm expert, but I think many of these problems may be related to file permissions.

On Linux systems, by default "npm install -g <package" will try to install packages under /usr/local. That requires root privileges, aka sudo, and is rarely what you want. On Linux systems, the /usr/local area is for packages that you have built yourself, and are installing for all users.

Instead, what you probably want, is to create a directory under your home directory, where you install npm tools that you want to use across many projects. As cornjuliox notes, detailed instructions for how to do that are here: https://docs.npmjs.com/getting-started/fixing-npm-permissions

I just created a pull request to add a link to that document to the installation instructions.

mkohler avatar May 12 '18 19:05 mkohler

Same problem with Ubuntu 18.04

palutz avatar May 14 '18 12:05 palutz

If this is what I think:

#225 to track the elm bug

#226 for the workaround

heyakyra avatar Jun 29 '18 14:06 heyakyra

I have the same issue even when running the install command with sudo, even running it as root ...

This happens to me on Fedora 28, with node 8.11.3 and npm 5.6.0

here a gist of the npm debug log: https://gist.github.com/VinceMacBuche/f1baf62388755167ea5c32c1258fce5c

Maybe a change in Node 8.11 ? (released in March ...)

VinceMacBuche avatar Jul 04 '18 15:07 VinceMacBuche

I finally manage to install it using

sudo npm install -g elm --unsafe-perm=true --allow-root

I remembered that it was an option that could be necessary for elm-github-install so i tried with elm, i guess some perms / file owner are not corresponding to Node/npm standard ...

Note that i found that this issue is quite common among other libs (found several links about a lifecycle issue) that were few month old ( From March to May) all about Node 8.11

VinceMacBuche avatar Jul 04 '18 22:07 VinceMacBuche