Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install failing (Error: EACCES: permission denied, mkdir) #21

Closed
alexgig opened this issue Apr 6, 2017 · 43 comments

Comments

Projects
None yet
@alexgig
Copy link

commented Apr 6, 2017

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

@samueller

This comment has been minimized.

Copy link

commented Apr 21, 2017

Having the same issue on macOS Sierra. I manually ran mkdir '/Users/scott/.elm-install' as it said permission denied for that command. Then I manually ran mkdir '/Users/scott/.elm-install/elm-install-0.3.1-osx' for the same reason. Now I get the following error:

Error: EPERM: operation not permitted, utime '/Users/scott/.elm-install/elm-install-0.3.1-osx/'

I'm running the latest version of npm (v4.5.0) and I also ran the install with sudo.

@gdotdesign

This comment has been minimized.

Copy link
Owner

commented Apr 21, 2017

I probably won't be able to reproduce this because I don't have access to a mac. If anyone could debug this I would be grateful.

In the mean time there are other ways of installing:

@samueller

This comment has been minimized.

Copy link

commented Apr 21, 2017

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.

@rupertlssmith

This comment has been minimized.

Copy link

commented May 8, 2017

Not just Macs, I get the same issue on Linux:

sudo npm install elm-github-install@1.0.0 -g
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@1.0.0 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/v1.0.0/elm-install-1.0.0-linux-x86_64.tar.gz
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: EACCES: permission denied, mkdir '/root/.elm-install/elm-install-1.0.0-linux-x86_64'
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "elm-github-install@1.0.0" "-g"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

@thienngho

This comment has been minimized.

Copy link

commented May 12, 2017

I got the same issue on Ubuntu


> elm-github-install@1.0.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/v1.0.1/elm-install-1.0.1-linux-x86_64.tar.gz
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: EACCES: permission denied, mkdir '/root/.elm-install/elm-install-1.0.1-linux-x86_64'
npm info lifecycle elm-github-install@1.0.1~install: Failed to exec install script
npm ERR! Linux 4.4.0-71-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "elm-github-install" "-g"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! elm-github-install@1.0.1 install: `node scripts/install.js`
npm ERR! Exit status 1```
@cscalfani

This comment has been minimized.

Copy link

commented Jun 13, 2017

@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.

@dbulic

This comment has been minimized.

Copy link

commented Jun 25, 2017

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
@on3iro

This comment has been minimized.

Copy link

commented Jul 26, 2017

Same problem, and also on ubuntu. The workaround with yarn @dbulic mentioned works, though.

@gdotdesign

This comment has been minimized.

Copy link
Owner

commented Aug 2, 2017

This PR #33 should fix this issue once released.

@rupertlssmith

This comment has been minimized.

Copy link

commented Aug 2, 2017

Muchos appreciated.

@gdotdesign

This comment has been minimized.

Copy link
Owner

commented Aug 4, 2017

Released as v1.2.0

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

@gdotdesign gdotdesign closed this Aug 7, 2017

@samueller

This comment has been minimized.

Copy link

commented Sep 10, 2017

v1.4.0 still causing an issue on my Mac:

Scotts-MacBook-Pro:learn scott$ sudo npm i elm-github-install -g
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/elm-install -> /usr/local/lib/node_modules/elm-github-install/scripts/run.js
/usr/local/bin/elm-github-install -> /usr/local/lib/node_modules/elm-github-install/scripts/run.js

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

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/elm-github-install/scripts/dist-1.4.0'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! elm-github-install@1.4.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the elm-github-install@1.4.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
@ColaKaii

This comment has been minimized.

Copy link

commented Sep 13, 2017

@cscalfani Thank you!!!!!!
This help me a lots!!!!!!!!!!!

@ghost

This comment has been minimized.

Copy link

commented Sep 28, 2017

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: npm/npm#17268

@gdotdesign

This comment has been minimized.

Copy link
Owner

commented Sep 28, 2017

Thank you! 🤗 I'll update the Readme to use that as a fallback.

@maksimluzik

This comment has been minimized.

Copy link

commented Oct 25, 2017

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.

@SmiffyKMc

This comment has been minimized.

Copy link

commented Jan 4, 2018

@maksimluzik I am having this issue trying to build an android sdk. I wrote what you said and it's still causing an issue. Can someone please give me a tip as I'm after spending 3 days at this and it's killing me oO.

My shell is:

source /etc/profile
set JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
set ANDROID_HOME=/Users/me/Library/Android/sdk
set PATH=%ANDROID_HOME%/platform-
tools:%ANDROID_HOME%/tools:%ANDROID_HOME%/tools/bin:%PATH%
npm install
bower install
ionic cordova build android

ERROR:

Error: EACCES: permission denied, open '/Users/me/Library/Android/sdk/tools/source.properties'

The file:

-rwxrwxrwx+  1 jenkins         jenkins        70 13 Dec  2016 source.properties
@maksimluzik

This comment has been minimized.

Copy link

commented Jan 5, 2018

@SmiffyKMc that looks weird issue indeed. Not sure whats up with that. If you are 100% sure that the path to that file is correct /Users/me/Library/Android/sdk/tools/source.properties then unfortunately don't know from your description what is the issue

@SmiffyKMc

This comment has been minimized.

Copy link

commented Jan 5, 2018

@maksimluzik ah shame, was hoping you'd know since your last comment was my issue. Sorry, my main issue is that I'm trying to build an Ionic Android App through Jenkins. I can build it perfectly fine on the terminal but Jenkins seems to be having issues with permissions. I made owner and group of the files from the folder that jenkins needs access to but it still gives a permission denied. Maybe if I did all this on a Docker image?

@agbottan

This comment has been minimized.

Copy link

commented Jan 13, 2018

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.

@GasCreature

This comment has been minimized.

Copy link

commented Jan 14, 2018

Still does not work. I'm using most recent Kali Linux.

@GasCreature

This comment has been minimized.

Copy link

commented Jan 14, 2018

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

@rokf

This comment has been minimized.

Copy link

commented Jan 25, 2018

@noformnocontent Thank you!

@gemantzu

This comment has been minimized.

Copy link

commented Feb 6, 2018

@dbulic Thank you, it works on Solus as well.

@deepakchaula

This comment has been minimized.

Copy link

commented Feb 19, 2018

try this to install package...

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

@playmobilman

This comment has been minimized.

Copy link

commented Feb 28, 2018

@deepakchaula Proven it's working!! Thanks!

@dtonhofer

This comment has been minimized.

Copy link

commented Mar 2, 2018

@deepakchaula

Nah, now it's "ELOOP: too many symbolic links encountered, open '/usr/lib/node_modules/npm/node_modules.bundled/tar/node_modules/minizlib/package.json.2876729455'"
and rightly so because "/usr/lib/node_modules/npm/" is actually a symlink to itself...

(Why is installation a problem? It's been done since more than 20 years now. ☠☠☠!!)

@eduardowickertg

This comment has been minimized.

Copy link

commented Mar 8, 2018

@noformnocontent Thank you dude!

@jameslaydigital

This comment has been minimized.

Copy link

commented Apr 23, 2018

Yup, had this problem on Debian. Fixed like so:

npm install elm
mv -vi node_modules/* /usr/local/lib/node_modules/

Afterwards I was able to run elm.

@melindangas

This comment has been minimized.

Copy link

commented May 4, 2018

@deepakchaula Thank you it worked!

@TongDaDa

This comment has been minimized.

Copy link

commented Jun 4, 2018

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

It does, however, there are no more questions

@kane0409

This comment has been minimized.

Copy link

commented Jul 24, 2018

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.

@Ewebstech

This comment has been minimized.

Copy link

commented Aug 13, 2018

@deepakchaula. Works fine. Thanks

@miguelortega20

This comment has been minimized.

Copy link

commented Sep 29, 2018

sd

@rohitlabhe

This comment has been minimized.

Copy link

commented Oct 4, 2018

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

@shov

This comment has been minimized.

Copy link

commented Oct 24, 2018

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

@darrencole

This comment has been minimized.

Copy link

commented Mar 25, 2019

Thank you @deepakchaula!

@c-yyy

This comment has been minimized.

Copy link

commented Apr 1, 2019

sudo npm i -g elm-github-install
or
sudo yarn global add elm-github-install

@freddy-daniel

This comment has been minimized.

Copy link

commented Apr 9, 2019

Still getting this issue on my mac

mac10s-Mac-mini:desktop-app mac10$ sudo npm install --cache /tmp/empty-cache
Password:

> electron@4.1.4 postinstall /Users/mac10/Documents/freddy/desktop-app/node_modules/electron
> node install.js

Downloading tmp-3049-1-SHASUMS256.txt-4.1.4
[============================================>] 100.0% of 4.74 kB (4.74 kB/s)
/Users/mac10/Documents/freddy/desktop-app/node_modules/electron/install.js:49
  throw err
  ^

Error: EACCES: permission denied, mkdir '/Users/mac10/Documents/freddy/desktop-app/node_modules/electron/dist'
npm WARN app@4.0.6 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@4.1.4 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron@4.1.4 postinstall 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!     /tmp/empty-cache/_logs/2019-04-09T11_27_33_000Z-debug.log
@darrencole

This comment has been minimized.

Copy link

commented Apr 9, 2019

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

@freddy-daniel

This comment has been minimized.

Copy link

commented Apr 9, 2019

I have fixed this issue by sudo chmod -R 777 on my project folder
And run npm install --cache /tmp/empty-cache without sudo now it's works fine

@doonfrs

This comment has been minimized.

Copy link

commented May 3, 2019

try this to install package...

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

Worked for me, Thank you!

@alirazashah

This comment has been minimized.

Copy link

commented Jul 11, 2019

@ghost's solution works for me, even whilst installing corvova-res globally. Thanks, Not all hero's wear capes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.