elm-github-install: npm install failing (Error: EACCES: permission denied, mkdir)

Hi,

I am having trouble installing this package globally. I run the following:

sudo npm install -g elm-github-install

and get the following:

npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/elm-github-install -> /usr/local/lib/node_modules/elm-github-install/scripts/run.js
/usr/local/bin/elm-install -> /usr/local/lib/node_modules/elm-github-install/scripts/run.js

> elm-github-install@0.3.1 install /usr/local/lib/node_modules/elm-github-install
> node scripts/install.js

Downloading and extracting the binary from: https://github.com/gdotdesign/elm-github-install/releases/download/v0.3.1/elm-install-0.3.1-osx.tar.gz
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: EACCES: permission denied, mkdir '/Users/alexandre/.elm-install'
    at Error (native)
npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "elm-github-install"
npm ERR! node v6.10.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! elm-github-install@0.3.1 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the elm-github-install@0.3.1 install script 'node scripts/install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the elm-github-install package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs elm-github-install
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls elm-github-install
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/alexandre/Projects/elm-node/test/npm-debug.log

Thanks, Alex

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 17
  • Comments: 53 (4 by maintainers)

Most upvoted comments

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

same for “just elm”

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

/related: https://github.com/npm/npm/issues/17268

try this to install package…

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

On Ubuntu 16.04 I am getting the same thing when using

sudo npm i -g elm

However, yarn works well

sudo yarn global add elm

sudo chown -R $USER ~/.npm worked for me

It worked for me by not installing globally. I just took off the -g flag. Then I ran elm-github-install with node_modules/.bin/elm-github-install.

@samueller After I created the 2 directories manually, I had to change the owner of the 2nd directory with:

sudo chown nobody elm-install-1.0.1-osx/

Then it WORKS!

BTW, afterwards you need to change ownership back to you for all files (-R) otherwise it won’t run:

sudo chown -R charles elm-install-1.0.1-osx/

Note: change charles to your user.

If you have no root access, HOME=./ npm i

@deepakchaula Thanks for command sudo npm install --unsafe-perm=true --allow-root It is working fine for Ubuntu.

if you install a package that you have the package name, you run ‘sudo npm install package_name --unsafe-perm=true --allow-root’. If you don’t know which package you missing, just run ‘sudo npm install --unsafe-perm=true --allow-root’ in your project folder that has node_modules.

This PR #33 should fix this issue once released.

I have deleted the ‘node_modules/’ folder and install npm package again. npm install And it worked 😃

Add more param like that --unsafe-perm=true --allow-root

sudo npm i --save [packagename] --unsafe-perm=true --allow-root

@freddy_daniel, try adding unsafe-perm=true --allow-root to the install command if you’re sure that what you are installing is safe.

Released as v1.2.0

If someone affected with this could test it out it would be appreciated 👍

@deepakchaula why sudo npm install --unsafe-perm=true --allow-root ?

It does, however, there are no more questions

@noformnocontent Your voodoo worked. You’re a genius.

I had the same kind of problem, with denied permissions. I’m using Linux Mint and, even with ‘sudo’, the permission to create folders was denied. I achieved the complete installation opening a new terminal window with the root user. My guess is that, even if we use ‘sudo’, npm can change it’s user in the flow and loose the permissions granted by ‘sudoing’. And, I think that using the root terminal may be a security issue.

This is permission issue on the folder. For some reason subfolder permissions were changed from jenkins to root which caused the issue. sudo chown -R jenkins:jenkins foldername solved the issue.

Muchos appreciated.