Open fabricemarchal opened 5 years ago
Is this on Mac or Linux?
In general, I'd recommend installing elm-format as a non-root user. Is there a reason you need it installed as root?
I'm not familiar with --unsafe-perm
. What does it do? Is the elm-format package doing something wrong that leads to this error?
The problem was on Mac. I installed first as user but got some permissions errors (hence the sudo).
I've had the same problem since 0.19 was released so I could never upgrade.
Via https://github.com/npm/npm/issues/17268 I eventually discovered the --unsafe-perm
trick, which works. Might want to make note of that in the install instructions for now. Also, make the title of this issue more specific.
sudo npm install -g elm-format
/usr/bin/elm-format -> /usr/lib/node_modules/elm-format/bin/elm-format
> elm-format@0.8.1 install /usr/lib/node_modules/elm-format
> binwrap-install
ERR Error extracting https://github.com/avh4/elm-format/releases/download/0.8.1/elm-format-0.8.1-linux-x64.tgz - Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/elm-format/unpacked_bin'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! elm-format@0.8.1 install: `binwrap-install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the elm-format@0.8.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
@Erudition saved my bacon! Thank you! :D
--unsafe-perm
worked! Shouldn't it be mentioned in docs? The issue is almost 2 years old!
Great tool btw!!! =D
Isn't this more an issue with managing the permissions around installing npm pacakges, and not elm-specific?
I'm new to using npm but see this section on their site. I was getting permission denied installing elm-test and elm-format so I did the second suggestion from that page, i.e.
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
NPM_CONFIG_PREFIX=~/.npm-global npm install -g elm-test elm-format
and that worked for me.
generates the following error:
ERR Error extracting https://github.com/avh4/elm-format/releases/download/0.8.0/elm-format-0.19-0.8.0-mac-x64.tgz - Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/elm-format/unpacked_bin'
with --unsafe-perm it works.