electron: Failed at the electron@1.4.13 postinstall script 'node install.js'
- Electron version: 1.4.13
- Operating system: Windows 10 64-bit
Actual behavior
14409 error node v7.3.0 14410 error npm v3.10.10 14411 error code ELIFECYCLE 14412 error electron@1.4.13 postinstall:
node install.js14412 error Exit status 1 14413 error Failed at the electron@1.4.13 postinstall script ‘node install.js’. 14413 error Make sure you have the latest version of node.js and npm installed. 14413 error If you do, this is most likely a problem with the electron package, 14413 error not with npm itself. 14413 error Tell the author that this fails on your system: 14413 error node install.js 14413 error You can get information on how to open an issue for this project with: 14413 error npm bugs electron 14413 error Or if that isn’t available, you can get their info via: 14413 error npm owner ls electron 14413 error There is likely additional logging output above. 14414 verbose exit [ 1, true ]
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (2 by maintainers)
Same problem here. Failed at
node install.js.Here’s the log: npm-debug.log.zip
The console shows some error about permission denied to link the release package. But I did used
sudocommand. I tried to manually perform the link and then runsudo node install.js. It put me on hold for over 10 mins showing me nothing, until I hitCtrl + Cto cancel.The release package
electron-v1.4.13-darwin-x64.zipis found under~/.electronwith size 42.1MB so the network should be fine. I unzipped the file and copied Electron.app to/Applicationsfolder. It works just fine. Launch the app and it tells me “To run your app with Electron, execute the following command in your Console (or Terminal):”/Applications/Electron.app/Contents/MacOS/Electron path-to-your-app. Run it with no path and it opened up another electron window.Guess a manually link to global CLI command is all I need to do next. But this doesn’t sound like a long-term solution for future upgrade with npm.
I also tried with the latest version 1.4.14. Nothing changed. Hope the team can fixed this ASAP. thx ahead.
Machine Specs:
Operating System: macOS Big Sur v11.6
NPM version: v6.14.13
Node version : v14.17.0
After some digging, I found this post that allowed me to get it installed globally.
TL;TR Open your terminal and execute the follow command
sudo npm install -g electron --unsafe-perm=true --allow-rootHope it helps!
Happy coding =)
facing the same issue, tried the last answer did not work, please help.
I’ve got a solution. Not the best way but should be enough if you need to install electron right now and don’t have time to wait for the official fix.
Everyone here got into trouble when it comes to
postinstall script 'node install.js'. So let’s start with that.Run
npm install --save electronfor your project and hitCtrl + Cwhen it comes to this sentence. The download has not complete yet but we’ve got what we need.Under
YOUR_PROJECT_PATH/node_modules/electron/you can find thisinstall.jsfile. If you open it and take a look. It’s simply some javascript code to download the release package (which you can download directly from Github) and extract it. That’s all. So either something went wrong with the network so the download took too long, or the script do not have permission to extract zip file and rename it.Since it crashes when running automatically, let’s do it manually.
Just follow what the file says:
YOUR_PROJECT_PATH/node_modules/electron.path.txtfile here. Writedist/Electron.app/Contents/MacOS/Electronand save it. (This is for mac, For Windows writedist/electron.exe, and for linux writedist/electron. You can find these in the end of ‘install.js’)Now you’ve installed it locally.
By running
./node_modules/electron/dist/Electron.app/Contents/MacOS/Electron .(don’t miss the dot at the beginning & end of the line), your project should start up. (For non-MacOS environment. the path might be a little different. I trust you can find the right one.)Next, you can either use npm script to make a alias for that loooooooong command. Or install electron globally so you can run
electronfrom the terminal. (Same process. Only this time runnpm install -g electronand do it under/usr/local/lib/node_modules/electron/)This worked for me. Hope it works for you too. Happy Coding!