electron: Electron fails to install

  • Electron version: Current
  • Operating system: Solus 3

Expected behavior

Electron should install globally using sudo npm install electron -g

Actual behavior

npm returns the following:

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

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

/usr/lib64/node_modules/electron/install.js:48
  throw err
  ^

Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/electron/electron-tmp-download-2773-1505598916799'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.7.6 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron@1.7.6 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-09-16T21_55_17_363Z-debug.log

How to reproduce

I have no idea what’s causing this because I’m new to node.

About this issue

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

Most upvoted comments

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

I solved this issue by just doing: “sudo chmod 0774 /usr/lib/node_modules/ -R” “sudo chown root:sudo /usr/lib/node_modules/ -R”

Of course, you need to be logged into a user that is a member of the group: sudo, but you probably are a member of sudo, adm, cd-rom, … just ‘sudo cat /etc/group’ to see if you’re a member.

Getting the same error on Mac 10.13.4.

` Error: EACCES: permission denied, mkdir ‘/Users/shane/Documents/R&D/Electron/electron-quick-start/node_modules/electron/dist’ 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.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/shane/.npm/_logs/2018-04-16T18_42_12_321Z-debug.log Shanes-MacBook-Pro:electron-quick-start shane$ `

Another way to get this bug, is to

sudo npm install electron --save-dev --save-exact

I keep getting this output

...
npm verb node v8.4.0
npm verb npm  v5.4.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.7.6 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron@1.7.6 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]

npm ERR! A complete log of this run can be found in:
...

Running on a MacBook with Sierra…