Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't update electron with npm

I cannot update electron-prebuilt. I executed sudo npm update electron-prebuilt -g many times.

But, The Permission denied Error occur every time in spite of using sudo.

Why I can't update electron successfully?

iojs3.2.0, OS X 10.10.5

The following is error log.

/usr/local/lib/node_modules/electron-prebuilt/install.js:15
  throw err
  ^

Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/electron-prebuilt/electron-tmp-download-818-1441021602097/electron-v0.31.1-darwin-x64.zip' -> '/Users/user_name/.electron/electron-v0.31.1-darwin-x64.zip'
at Error (native)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "install" "electron-prebuilt" "-g"
npm ERR! node v3.2.0
npm ERR! npm  v2.14.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script 'node install.js'.
npm ERR! This is most likely a problem with the electron-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/local/lib/node_modules/npm-debug.log
like image 620
KiYugadgeter Avatar asked Aug 31 '15 12:08

KiYugadgeter


People also ask

How do I update my electron version?

The easiest way to use this service is by installing update-electron-app, a Node. js module preconfigured for use with update.electronjs.org. Install the module using your Node.

How do I update a node package?

To update a specific Node package, you can use the npm update command. This command takes a package name as an argument and updates it to the latest version.


2 Answers

The issue is reported at https://github.com/mafintosh/electron-prebuilt/issues/48 and a workaround seems to be to first install without the -g flag which will get the file into user folder first, and then install again with -g.

EDIT: I guess somehow the permissions are messed up and I'm doing chmod. It seems that if I chmod not only for the user myself but also for group and others it works. Maybe others could also give it a try?

like image 141
xji Avatar answered Oct 19 '22 02:10

xji


I had the same problem in OS X. I fixed it deleting the ~/.electron folder

like image 38
Mati Tucci Avatar answered Oct 19 '22 02:10

Mati Tucci