Elm's npm package installation fails on npm@v5.x and node@v8.x
tomasz opened this issue ยท 11 comments
Hi,
The command npm install --global elm
fails (with error message below) when run on a machine with node v8.2.1 and npm v5.3.0 both on macOS 10.12.6 and Debian 8. This can be reproduced inside a docker like so:
$ docker run -it --rm node:8 bash
root@1482e838325d:/# node -v
v8.2.1
root@1482e838325d:/# npm -v
5.3.0
root@1482e838325d:/# uname -a
Linux 1482e838325d 4.9.36-moby #1 SMP Wed Jul 12 15:29:07 UTC 2017 x86_64 GNU/Linux
root@1482e838325d:/# npm i -g elm
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.2.1
npm http fetch GET 200 https://registry.npmjs.org/elm 240ms
...
npm info lifecycle elm@0.18.0~install: elm@0.18.0
> elm@0.18.0 install /usr/local/lib/node_modules/elm
> node install.js
Error extracting linux-x64.tar.gz - Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/elm/Elm-Platform'
npm info lifecycle elm@0.18.0~install: Failed to exec install script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! elm@0.18.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the elm@0.18.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-03T12_57_07_376Z-debug.log
root@1482e838325d:/#
The same command works flawlessly with
- node@v6.11.2 and npm@v3.10.10
- node@v7.10.1 and npm@v4.2.0
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
The workaround for now would be to install elm
through yarn global add elm
. Yarn worked on each node's major version 6.x, 7.x and 8.x so far.
https://gist.github.com/anonymous/b3d4a4c1c6aa7e586d55bf7efdb617bf
actually this message tells you that you don't have access to the '/usr/local/lib/node_modules/elm/Elm-Platform' you can fix this by crating a directory 'npm-global' then running npm config set prefix /$HOME/npm-global
that will change where npm install global packages.
Running npm i -g elm
wont fail after that.
I put a link from the official npm site that shows this strategie as well as others
npm
that worked for me.
let me know if something don't work for you.
The link above is not correct.
https://docs.npmjs.com/getting-started/fixing-npm-permissions
That's surprising since mine don't work and yours works! even if they are identical !
Hi. Just some feedback if someone has a simular problem
I have tried the tip to use yarn from @tomasz and it worked fine for me.
Somehow it did not feel right for me to change my standard setup only to install elm. That said it is indeed the solution the npm team reccomends on their web page.
The links from @yogin25 and @jinjor look identical in the text, but if you hover with the mouse over the link and see the link the browser would follow you will see that the first one leads not to the requested page but into github nirvana. Why that is I don't know.
It seems like it was my mistake, that was corrected
With Archlinux I got the same error when I tried to install with npm install -g elm
The solution with yarn global add elm
fix it. Add to your path export PATH="$PATH:`yarn global bin`"
and you can use elm commands.
I had the same issue on Ubuntu 16.04 LTS and ended up removing node, installing NVM, and installing node/npm via NVM. Then I could npm install -g elm
as advertised without issue. This was after trying to change NPM permissions, trying Yarn, and a couple other rabbit holes.
Strange part is I had Ubuntu 16.04 LTS running on a VirtualBox on a Windows machine and npm install -g elm
worked without any fuss.
Same problem on a Ubuntu 16.04 VM with node v8.9.3 and npm 5.6.0.
What fixed it for me was to add the --unsafe-perm=true
param:
sudo npm install -g elm --unsafe-perm=true
I recommend asking for help on things like this on Slack. If there is anything that needs to be changed in this repo, I need it reduced down to a specific feature requests, ideally with an http://sscce.org/ of the problem. (Perhaps a link to a CI build that failed, demoing the problem.)