Skip to content
This repository has been archived by the owner. It is now read-only.

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron/.electron' #17268

Open
Jacksonler opened this issue Jun 17, 2017 · 63 comments

Comments

@Jacksonler
Copy link

commented Jun 17, 2017

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron/.electron'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.6.11 postinstall: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.6.11 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! /root/.npm/_logs/2017-06-17T04_24_22_944Z-debug.log
root@lhh-Inspiron-5537:/# gedit /root/.npm/_logs/2017-06-17T04_23_14_538Z-debug.log
####How to solve it?

@a1626

This comment has been minimized.

Copy link

commented Jun 17, 2017

Try running npm install with sudo.

@olya777

This comment has been minimized.

Copy link

commented Jun 19, 2017

I tried running with sudo. Still same issue

@a1626

This comment has been minimized.

Copy link

commented Jun 20, 2017

Can you provide more details like module name, OS, npm version.

@ander7agar

This comment has been minimized.

Copy link

commented Jun 20, 2017

I have the same issue. I use Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux. I have executed the command as root and I have obtained this output:

/usr/local/bin/electron -> /usr/local/lib/node_modules/electron/cli.js

> electron@1.6.11 postinstall /usr/local/lib/node_modules/electron
> node install.js

/usr/local/lib/node_modules/electron/install.js:47
  throw err
  ^

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron/.electron'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.6.11 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron@1.6.11 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!     /root/.npm/_logs/2017-06-20T10_25_47_997Z-debug.log
@a1626

This comment has been minimized.

Copy link

commented Jun 20, 2017

which package?

@reblevins

This comment has been minimized.

Copy link

commented Jun 20, 2017

I'm getting the same error with sudo npm install -g electron@1.7.2 and also sudo npm install -g electron

Linux version 3.18.0-14856-g9bbe428768eb (chrome-bot@cros-beefy107-c2) (gcc version 4.9.x 20150123 (prerelease) (4.9.2_cos_gg_4.9.2-r154-32c89c19b042a12b5a1bf0153299154ea5435c03_4.9.2-r154) ) #1 SMP PREEMPT Wed Jun 14 22:13:29 PDT 2017

(I am running inside a chroot on a Chromebook if that makes any difference.)

I have attached the output from /home/username_redacted/.npm/_logs/2017-06-20T14_43_16_506Z-debug.log.
2017-06-20T14_43_16_506Z-debug.txt

@ander7agar

This comment has been minimized.

Copy link

commented Jun 20, 2017

I'm trying to install it using sudo npm install -g electron. I have these versions installed:

npm -v
5.0.3
node -v
v7.4.0
@a1626

This comment has been minimized.

Copy link

commented Jun 20, 2017

The problem doesn't seem to be with npm install but with postinstall script of electron.

I think the correct place to open an issue will be electron's repository, otherwise you can also try changing global repository to some other location where sudo is not required.

@reblevins

This comment has been minimized.

Copy link

commented Jun 20, 2017

Ah yes, you're right. I just landed on this page from Google and didn't even check where I was. My bad.

@a1626

This comment has been minimized.

Copy link

commented Jun 21, 2017

i've opened an issue with electron-prebuilt for same.

@ander7agar

This comment has been minimized.

Copy link

commented Jun 21, 2017

This command fix the issue. It works for me:

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

@reblevins

This comment has been minimized.

Copy link

commented Jun 21, 2017

@ander7agar that did the trick! Thanks.

@a1626

This comment has been minimized.

Copy link

commented Jun 22, 2017

minor correction --allow-root is not required, and i don't think any such flag exist in npm (it's there in bower).

@onevcat

This comment has been minimized.

Copy link

commented Jul 3, 2017

Same problem

@a1626

This comment has been minimized.

Copy link

commented Jul 3, 2017

@onevcat Please use the command suggested by @ander7agar in his last comment.

@lshengjian

This comment has been minimized.

Copy link

commented Jul 21, 2017

npm -v
5.3.0
node -v
v8.1.4

electron@1.6.11 postinstall /usr/lib/node_modules/electron
node install.js

/usr/lib/node_modules/electron/install.js:47
throw err
^

Error: connect ETIMEDOUT 54.231.73.51:443
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.6.11 postinstall: node install.js
npm ERR! Exit status 1

@wlongxiang

This comment has been minimized.

Copy link

commented Aug 10, 2017

@ander7agar This commands solved my problem, thanks dude!

@fuzzyVineStone

This comment has been minimized.

Copy link

commented Sep 9, 2017

Problem solved with @ander7agar's solution. Thank you.

@omarxp

This comment has been minimized.

Copy link

commented Sep 11, 2017

thanks @ander7agar It works for me.

@hitalo07

This comment has been minimized.

Copy link

commented Sep 26, 2017

@ander7agar This commands solved my problem. Thank you.

@Celtak

This comment has been minimized.

Copy link

commented Sep 28, 2017

Good. Problem finally solved thank you very much @ander7agar

@Jkmorais

This comment has been minimized.

Copy link

commented Oct 21, 2017

@ander7agar Thank you! saved my project!

@erdemildiz

This comment has been minimized.

Copy link

commented Oct 24, 2017

Thanks @ander7agar Its works 🎉

@LalaRzayeva

This comment has been minimized.

Copy link

commented Nov 7, 2017

thanks @ander7agar, it works for me also !

@dsouzadyn

This comment has been minimized.

Copy link

commented Nov 16, 2017

This should still be fixed I think

@aetheryx

This comment has been minimized.

Copy link

commented Nov 18, 2017

Still broken on my end - running on Arch, node v8.8.1, npm 5.5.1. ander7agar's script works fine.

@jlnmay

This comment has been minimized.

Copy link

commented Mar 16, 2018

I had a similar problem with sudo npm install
this fix my issue sudo npm install --unsafe-perm=true --allow-root.

Thanks @ander7agar

@engrashid

This comment has been minimized.

Copy link

commented Apr 9, 2018

@ander7agar thanks that worked

@khiami

This comment has been minimized.

Copy link

commented Apr 15, 2018

I was successfully able to install electron with the following

# on project directory
npm cache clean --force
# npm install
# cd to where npm globally installs the packages (check yours via npm -g root)
cd /usr/local/lib/
sudo npm install electron

I tried the same thing but from my project directory and failed.. threw access denied error.

@NatoBoram

This comment has been minimized.

Copy link

commented Apr 20, 2018

#17268 (comment)

sudo npm install -g electron --unsafe-perm=true --allow-root
/usr/bin/electron -> /usr/lib/node_modules/electron/cli.js

> electron@1.8.4 postinstall /usr/lib/node_modules/electron
> node install.js

Downloading electron-v1.8.4-linux-x64.zip
Error: self signed certificate in certificate chain
/usr/lib/node_modules/electron/install.js:47
  throw err
  ^

Error: self signed certificate in certificate chain
    at TLSSocket.<anonymous> (_tls_wrap.js:1105:38)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket._finishInit (_tls_wrap.js:639:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:469:38)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.8.4 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron@1.8.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
@gasparyanyur

This comment has been minimized.

Copy link

commented Apr 26, 2018

@NatoBoram I have get the same error. Have you solve it ?

@danieldram

This comment has been minimized.

Copy link

commented May 4, 2018

someone needs to give @ander7agar an award or something wow thank you!

@ghost

This comment has been minimized.

Copy link

commented May 12, 2018

@ander7agar Thank you, it works even for other packages.

@NatoBoram

This comment has been minimized.

Copy link

commented May 28, 2018

@gasparyanyur Nope. We abandoned the project. If we can't install the framework, just imagine what kind of pile of trash we're going to have to deal with in the future. But if you find a solution, I'm still searching for it -- for personal curiosity, this time.

@PierBover

This comment has been minimized.

Copy link

commented Jun 5, 2018

Not sure if NPM or Electron is to blame here, but since I didn't want to install globally I simply did:

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

And it worked.

@caleberi

This comment has been minimized.

Copy link

commented Jun 17, 2018

pls,i tried using sudo npm install -g electron --unsafe-perm=true --allow-root but i got this error
`/home/ace/Documents/projects/electron/Electron# sudo npm install electron --unsafe-perm=true --allow-root

electron@1.8.7 postinstall /home/ace/Documents/projects/electron/Electron/node_modules/electron
node install.js

Downloading electron-v1.8.7-linux-x64.zip
Error: tunneling socket could not be established, statusCode=400
/home/ace/Documents/projects/electron/Electron/node_modules/electron/install.js:47
throw err
^

Error: tunneling socket could not be established, statusCode=400
at ClientRequest.onConnect (/home/ace/Documents/projects/electron/Electron/node_modules/tunnel-agent/index.js:166:19)
at Object.onceWrapper (events.js:319:30)
at emitThree (events.js:136:13)
at ClientRequest.emit (events.js:217:7)
at TLSSocket.socketOnData (_http_client.js:474:11)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at TLSSocket.Readable.push (_stream_readable.js:208:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.8.7 postinstall: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.8.7 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! /root/.npm/_logs/2018-06-17T21_33_03_089Z-debug.log
`

@legodude17

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2018

That is an issue with electron, and probably your internet

@flounders

This comment has been minimized.

Copy link

commented Jun 20, 2018

I'm getting the same problem, not with Electron, but with Purescript. The solution @ander7agar gave works. When I ran sudo npm install -g --unsafe-perm=true --allow-root purescript, it worked.

Here is the output I got before trying that command:

$ sudo npm install -g purescript
[sudo] password for swilliams:
/usr/bin/purs -> /usr/lib/node_modules/purescript/purs.bin

> purescript@0.12.0 postinstall /usr/lib/node_modules/purescript
> install-purescript --purs-ver=0.12.0 .

✔ Check if a prebuilt 0.12.0 binary is provided for Linux (1s)
✖ Download the prebuilt PureScript binary
  https://github-production-release-asset-2e65be.s3.amazonaws.com/13206906/5a0581e4-5d11-11e8-8b97-abcb676fe5ed?X-Amz-Algorithm=AWS…
  Error: EACCES: permission denied, open 'purs.bin'
▬ Verify the prebuilt binary works correctly
▬ Save the downloaded binary to the cache directory

↓ Fallback: building from source

✔ Check if 'stack' command is available
  1.7.1 found at /usr/bin/stack
✖ Download the PureScript 0.12.0 source
  Error: EACCES: permission denied, mkdtemp '/usr/lib/node_modules/purescript/node-purescript-QA11jY'
▬ Ensure the appropriate GHC is installed
▬ Build a binary from source
▬ Save the built binary to the cache directory

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! purescript@0.12.0 postinstall: `install-purescript --purs-ver=0.12.0 .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the purescript@0.12.0 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!     /root/.npm/_logs/2018-06-20T01_08_17_775Z-debug.log

I'm running Arch Linux x86_64 with kernel 4.16.13.2.

@YuriyKartuzov

This comment has been minimized.

Copy link

commented Jun 26, 2018

I had the same error, and it was fixed without running sudo command (npm install -g electron --unsafe-perm=true --allow-root) by properly specifying a path to an existing directory. So mkdir command does not need to be run.
(Error: EACCES: permission denied, mkdir ...)

@devlargs

This comment has been minimized.

Copy link

commented Jul 5, 2018

Thank you very much @ander7agar

@KenanY KenanY added the support label Jul 5, 2018
@ErvalhouS

This comment has been minimized.

Copy link

commented Jul 11, 2018

Stop using npm for it and use yarn global add electron which works and is a npm wrapper that avoids unsafe sudo usage. If you are confused about it, checkout the migration guide

@LaxmishJoshi

This comment has been minimized.

Copy link

commented Jul 11, 2018

In my case, error was with installing node-sass which in turn was a dependency of gulp-sass@3.9.1.

I upgraded gulp-sass to 4.0.0, with that gulp-sass pulled node-sass@4.9.2.
With that "npm install" in my project base worked fine without errors.

Node: 10.6.0
NPM: 6.1.0
Environment: Ubuntu 16.04

I still feel, using "unsafe-perm=true " (as mentioned in above comments) is NOT a great idea. It can be very good workaround. But not a solution for the issue.

@DanielRuf

This comment has been minimized.

Copy link

commented Jul 11, 2018

npm wrapper that avoids unsafe sudo usage

Not directly. it uses the npmjs registry behind its own domain name (proxy). The rest is yarn =)

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