Electron: Error: Electron failed to install correctly, please delete node_modules/electron and try installing again

Created on 21 Jan 2017  ·  54Comments  ·  Source: electron/electron

  • Electron version: latest (That Try)
  • Operating system: Microsoft Windows [Versión 10.0.10586]

Expected behavior

Install from "npm" on Windows

Actual behavior

I can not use Electron because it is not installed correctly, despite using the shell in administrator mode. Note that when installing dependencies, it does not finish displaying the dependency tree that normally shows "npm".

How to reproduce

git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install
npm start

> [email protected] start PATH\electron-quick-start
> electron .

PATH\electron-quick-start\node_modules\electron\index.js:9
throw new Error('Electron failed to install correctly, please delete node_modules/' + path.basename(__dirname) + ' and try installing again')
^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at Object.<anonymous> (PATH\electron-quick-start\node_modules\electron\index.js:9:9)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (PATH\electron-quick-start\node_modules\electron\cli.js:3:16)
at Module._compile (module.js:570:32)

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\nodejs\\node.exe" "C:\\Users\\{user_name}\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.9.4
npm ERR! npm v4.1.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: electron .
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'electron .'.
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 electron-quick-start package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! electron .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs electron-quick-start
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls electron-quick-start
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! PATH\electron-quick-start\npm-debug.log

npm-debug.txt

THANKS!

blockeneed-info ❌

Most helpful comment

Try

npm install electron --verbose

It should output a progress bar for the download 👍

All 54 comments

despite using the shell in administrator mode

That's generally a really bad idea. Does your NPM/Node environment work without admin mode?

I mean, have you tried doing what the error suggests and and deleting "node_modules/electron" and trying again?

@MarshallOfSound That's right, I did it several times.

It seems strange to me one thing, during the installation of modules, apparently does not finish correctly, because it remains as follows:

$ npm install

> [email protected] postinstall C:\Users\Lizandro Zerpa\Desktop\SisTelSim\SisTelSim_Dev\electron-quick-start\node_modules\electron
> node install.js
(It remains on hold)

@enlight I have installed multiple global instances, and they work correctly. I rarely have to install them with an administrator.

@LizanLycan It remains on node install.js while it downloads Electron. Please let it finish and don't cancel it halfway through.

@MarshallOfSound Ok that's what I've been doing. I was looking for the size of the package to give me an idea of ​​how long it might take, but I did not get it. I left it for over 1 hour. Still waiting, thanks for the comment.

Try

npm install electron --verbose

It should output a progress bar for the download 👍

@MarshallOfSound Thank you very much. I can now see the download progress. I'll wait until I finish and comment. 👍

@MarshallOfSound
Apparently little hard joy.

[email protected] postinstall C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
node install.js

Downloading electron-v1.4.15-win32-x64.zip
Error: read ECONNRESET
C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron\install.js:46
throw err
^

Error: read ECONNRESET
at exports._errnoException (util.js:1022:11)
at TLSWrap.onread (net.js:569:26)
npm verb lifecycle [email protected]~postinstall: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]~postinstall: PATH: C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modulesnpm\bin\node-gyp-bin;C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron\node_modules.bin;C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules.bin;C:\Program Files (x86)NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWSsystem32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Users\Lizandro Zerpa.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Ruby22-x64\bin;C:\MinGW\bin;C:\MinGW\msys\bin\1.0;C:\Users\Lizandro Zerpa\AppData\Roamingnpm
npm verb lifecycle [email protected]~postinstall: CWD: C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm info lifecycle [email protected]~postinstall: Failed to exec postinstall script
npm verb unlock done using C:\Users\Lizandro Zerpa\AppData\Roamingnpm-cache_locksstaging-d38db31138d15c28.lock for C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules.staging
npm verb gentlyRm don't care about contents; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb gentlyRm don't care about contents; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb gentlyRm don't care about contents; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb gentlyRm don't care about contents; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb gentlyRm don't care about contents; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb gentlyRm don't care about contents; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb gentlyRm don't care about contents; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb gentlyRm don't care about contents; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb gentlyRm don't care about contents; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb stack Error: [email protected] postinstall: node install.js
npm verb stack Exit status 1
npm verb stack at EventEmitter. (C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modulesnpm\lib\utils\lifecycle.js:279:16)
npm verb stack at emitTwo (events.js:106:13)
npm verb stack at EventEmitter.emit (events.js:191:7)
npm verb stack at ChildProcess. (C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modulesnpm\lib\utilsspawn.js:40:14)
npm verb stack at emitTwo (events.js:106:13)
npm verb stack at ChildProcess.emit (events.js:191:7)
npm verb stack at maybeClose (internal/child_process.js:877:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm verb pkgid [email protected]
npm verb cwd C:\Users\Lizandro Zerpa\Desktop\SisTelSim\SisTelSim_Dev\electron-quick-start
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\nodejs\node.exe" "C:\Users\Lizandro Zerpa\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "electron" "-g" "--verbose"
npm ERR! node v6.9.4
npm ERR! npm v4.1.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! 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 electron 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 information on how to open an issue for this project with:
npm ERR! npm bugs electron
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls electron
npm ERR! There is likely additional logging output above.
npm verb exit [ 1, true ]

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Lizandro Zerpa\Desktop\SisTelSim\SisTelSim_Dev\electron-quick-startnpm-debug.log

Looks like you're having some network issues (which are out of our control 😢 )

You can download the ZIP file manually in your browser from here and place it in your C:\Users\<username>\.electron folder. Then it won't need to download itself 👍

Can't find a solution for this -
m WARN lifecycle [email protected]~postinstall: cannot run in wd %s %s (wd=%s) [email protected] node install.js /home/nikhil/workspace/electron_demo/electron-quick-start/node_modules/electron
[email protected] /home/nikhil/workspace/electron_demo/electron-quick-start
-- [email protected] +-- [email protected] | +-- [email protected] | |-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | -- [email protected] | |-- [email protected]
| | +-- fs.[email protected]
| | +-- [email protected]
| | | -- [email protected] | | +-- [email protected] | | |-- [email protected]
| | | +-- [email protected]
| | | -- [email protected] | |-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | -- [email protected] | | | +-- [email protected] | | | |-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | | -- [email protected] | | | |-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | | -- [email protected] | | | |-- [email protected]
| | | | +-- [email protected]
| | | | | -- [email protected] | | | |-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | -- [email protected] | | | | +-- [email protected] | | | | | +-- [email protected] | | | | | |-- [email protected]
| | | | | | -- [email protected] | | | | | +-- [email protected] | | | | |-- [email protected]
| | | | | -- [email protected] | | | |-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | | -- [email protected] | | | | |-- [email protected]
| | | | -- [email protected] | | |-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | -- [email protected] | | | +-- [email protected] | | | |-- [email protected]
| | | -- [email protected] | | |-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | |-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | -- [email protected] | | | | +-- [email protected] | | | | |-- [email protected]
| | | | -- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | |-- [email protected]
| | | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | |-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | -- [email protected] | | | |-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | | -- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | |-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | |-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | |-- [email protected]
| | +-- [email protected]
| | | -- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | |-- [email protected]
| | | -- [email protected] | | |-- [email protected]
| | -- [email protected] | +-- [email protected] | |-- [email protected]
| | -- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | |-- [email protected]
| +-- [email protected]
| -- [email protected] |-- [email protected]
-- [email protected] +-- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | |-- [email protected]
| -- [email protected] +-- [email protected] +-- [email protected] |-- [email protected]
-- [email protected] -- [email protected]
`-- [email protected]

[email protected] start /home/nikhil/workspace/electron_demo/electron-quick-start
electron .

/home/nikhil/workspace/electron_demo/electron-quick-start/node_modules/electron/index.js:9
throw new Error('Electron failed to install correctly, please delete node_modules/' + path.basename(__dirname) + ' and try installing again')
^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at Object. (/home/nikhil/workspace/electron_demo/electron-quick-start/node_modules/electron/index.js:9:9)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/home/nikhil/workspace/electron_demo/electron-quick-start/node_modules/electron/cli.js:3:16)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)

npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: electron .
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'electron .'.
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 electron-quick-start package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! electron .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs electron-quick-start
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls electron-quick-start
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/nikhil/workspace/electron_demo/electron-quick-start/npm-debug.log

@MarshallOfSound helped me to correct this by observing the download and installation process with:

npm install electron -g --verbose

With this command you will install global Electron. You can not cancel until the download process is complete. Delete the folder node_modules and reinstall.

@LizanLycan
Was your solution to install electron both globally and locally? Or one or the other?

Please help...I've tried everything...

the modules dir include install.js, run and install it, the path.txt is written. It works

I figured out my problem. I had JavaScript errors in my Angular 2 components. For some reason if you have errors in your JavaScript, it'll just give you this electron installed incorrectly error.

I had the same problem. I fixed it by removing all the folders that starts with the name electorn (around 5 were there) and ran npm install with verbose flag. npm i --verbose . Then it showed progress bar for electron binaries download and downloaded fine. It's mostly because of bad internet connection. yes, i was on a connection of 150kbps.

@LizanLycan + @manojvignesh - awesome suggestion!
with --verbose it makes it much more obvious if you're somehow interrupting the electron module download during node_modules install

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again

@ijry you tried install with --vebose sentence?

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again

none useful , i try gooogle and google , never worked.................................

This solved my issue:
https://stackoverflow.com/questions/42636151/electron-failed-to-install-correctly-please-delete-node-modules-and-try-instal

npm install electron-prebuilt --save-dev

Seems that you have to have a version of pre-built electron installed in same project.

cnpm install electron -g --verbose

@MarshallOfSound thanks it works fine :)

@nikparmar I got same error and you're using LINUX try this sudo npm install electron --verbose

I don't understand enough about npm to debug the underlying issue but it seems that the Electron API Demo App is not successfully running the "postinstall": "node install.js" task. This postinstall task does get listed when running npm install --verbose but it doesn't seem to run.
After installing, I have to manually run node node_modules/electron/install.js

target: 'electron-renderer'

webpack.config.js use this

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

See in the message that it is saying that there is a directory where the global npm package is installed. In your case it is inside:
*PATH\electron-quick-start\node_modules*

So go to that directory and delete all the directory named prefixing electron.

Now run
npm install -g react-devtools

After that you are ready to roll.

To start the dev tools, write the following command.

react-devtools

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

it works for me

So npm start was working fine without errors.

I installed electron-builder and created a new package.json file for building the distribution.
When I do npm run dist it will succesfully create an exe installer for me and I can run and install app just fine.

But when I swap my package.json file back to original one and try to do npm start again I now get this error about electron failed to install correctly.

Not sure what is causing error, but the following SOLUTION worked for me:

Go to the directory node_modules/ and delete electron directory.

Then run npm install electron --save-dev

Now both npm start and npm run dist work fine without errors.

Found this solution here: https://stackoverflow.com/questions/42636151/electron-failed-to-install-correctly-please-delete-node-modules-and-try-instal

I changed the package.json
from
"electron": "^4.0.1",
to

   "electron": "^4.1.1",
    "electron-packager": "^13.1.1",
    "electron-tabs": "^0.9.5",

then , npm install
it works. The window is appear. But I don't know why...

When I setup electron-quick-start with npm install and run with npm start then just nothing happens... I am on MacBook Pro with macOS Catalina... All electron apps just stopped working for me... I have tested to delete the globally installed electron and reinstall, deleted node_modules and reinitialized... I have even removed the npm cache... So I don't know what to do anymore...
When I manually run electron . then this is what I get:

/usr/local/lib/node_modules/electron/index.js:14
    throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
    ^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
    at getElectronPath (/usr/local/lib/node_modules/electron/index.js:14:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/electron/index.js:18:18)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/usr/local/lib/node_modules/electron/cli.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:774:30

Hmm...
This is what I was getting:

$ npm start --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start', '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb run-script [ 'prestart', 'start', 'poststart' ]
npm info lifecycle [email protected]~prestart: [email protected]
npm info lifecycle [email protected]~start: [email protected]
npm info lifecycle [email protected]~start: ignored because ignore-scripts is set to true [email protected]
npm info lifecycle [email protected]~poststart: [email protected]
npm verb exit [ 0, true ]
npm timing npm Completed in 91ms
npm info ok

So I turned off the ignore-scripts with npm config set ignore-scripts false command and this is what I get now... ELIFECYCLE error.

$ npm start

> [email protected] start /Users/.../Documents/Javascript/electron-quick-start
> electron .

/Users/.../Documents/Javascript/electron-quick-start/node_modules/electron/index.js:14
    throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
    ^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
    at getElectronPath (/Users/.../Documents/Javascript/electron-quick-start/node_modules/electron/index.js:14:11)
    at Object.<anonymous> (/Users/.../Documents/Javascript/electron-quick-start/node_modules/electron/index.js:18:18)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/Users/.../Documents/Javascript/electron-quick-start/node_modules/electron/cli.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `electron .`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start 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/.../.npm/_logs/2019-11-29T16_52_39_548Z-debug.log

Hmm... What is happening? When I use yarn it works...
https://github.com/electron/electron-quick-start/issues/155#issuecomment-343283182

yarn run start

Been waiting, but I seem to see him fail to find the installer.

F:\testelectron-quick-start>npm install electron --verbose
npm info it worked if it ends with ok
npm verb cli [ 'C:\Program Files\nodejs\node.exe',
npm verb cli 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
npm verb cli 'install',
npm verb cli 'electron',
npm verb cli '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb npm-session 5dd5cd74a42cab9c
npm http fetch GET 304 http://registry.npm.taobao.org/electron 173ms (from cache)
npm timing stage:loadCurrentTree Completed in 374ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 2ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 93ms
npm http fetch GET 304 http://registry.npm.taobao.org/@electron%2fget 61ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/extract-zip 95ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/@types%2fnode 100ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/env-paths 66ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/fs-extra 73ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/debug 77ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/global-agent 96ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/got 106ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/global-tunnel-ng 118ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/sumchecker 277ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/sanitize-filename 465ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/ms 43ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/universalify 51ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/graceful-fs 59ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/jsonfile 62ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/matcher 66ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/core-js 72ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/es6-error 80ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/roarr 83ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/semver 90ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/boolean 97ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/serialize-error 109ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/escape-string-regexp 48ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/json-stringify-safe 69ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/detect-node 72ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/semver-compare 75ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/globalthis 79ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/sprintf-js 80ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/function-bind 46ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/object-keys 58ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/define-properties 63ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/type-fest 44ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/npm-conf 53ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/tunnel 55ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/lodash 70ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/encodeurl 97ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/config-chain 42ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/pify 52ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/proto-list 48ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/ini 53ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/@sindresorhus%2fis 75ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/decompress-response 90ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/@szmarczak%2fhttp-timer 95ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/duplexer3 98ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/cacheable-request 100ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/to-readable-stream 100ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/lowercase-keys 104ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/get-stream 110ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/mimic-response 146ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/url-parse-lax 73ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/p-cancelable 982ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/defer-to-connect 44ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/clone-response 60ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/responselike 67ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/keyv 72ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/http-cache-semantics 77ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/normalize-url 81ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/pump 64ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/end-of-stream 46ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/once 48ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/wrappy 52ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/json-buffer 46ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/prepend-http 51ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/truncate-utf8-bytes 133ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/utf8-byte-length 93ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/yauzl 47ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/mkdirp 59ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/concat-stream 725ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/buffer-from 52ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/typedarray 58ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/readable-stream 59ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/inherits 64ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/isarray 61ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/core-util-is 63ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/safe-buffer 64ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/process-nextick-args 67ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/string_decoder 73ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/util-deprecate 78ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/minimist 43ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/fd-slicer 49ms (from cache)
npm http fetch GET 304 http://registry.npm.taobao.org/pend 46ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 3977ms
npm timing stage:loadIdealTree Completed in 4100ms
npm timing stage:generateActionsToTake Completed in 13ms
npm verb correctMkdir C:\Users\Administrator\AppData\Roamingnpm-cache_locks correctMkdir not in flight; initializing
npm verb makeCacheDir UID & GID are irrelevant on win32
npm verb lock using C:\Users\Administrator\AppData\Roamingnpm-cache_locksstaging-7ab5b6ace88370a8.lock for F:\testelectron-quick-start\node_modules.staging
npm timing action:extract Completed in 27ms
npm info lifecycle [email protected]~preuninstall: [email protected]
npm info lifecycle [email protected]~uninstall: [email protected]
npm verb unbuild rmStuff [email protected] from F:\testelectron-quick-start\node_modules
npm info lifecycle [email protected]~postuninstall: [email protected]
npm timing action:unbuild Completed in 16ms
npm timing action:remove Completed in 7ms
npm timing action:finalize Completed in 2ms
npm timing action:refresh-package-json Completed in 28ms
npm info lifecycle [email protected]~preinstall: [email protected]
npm timing action:preinstall Completed in 1ms
npm info linkStuff [email protected]
npm verb linkBins [ { electron: 'cli.js' },
npm verb linkBins 'F:\test\electron-quick-start\node_modules\.bin',
npm verb linkBins false ]
npm http fetch POST 404 http://registry.npm.taobao.org/-/npm/v1/security/audits/quick 108ms
npm timing action:build Completed in 18ms
npm info lifecycle [email protected]~install: [email protected]
npm timing action:install Completed in 2ms
npm info lifecycle [email protected]~postinstall: [email protected]

[email protected] postinstall F:\testelectron-quick-start\node_moduleselectron
node install.js

I found a way in Chinese region.

Step 1. npm install electron
Step 2. download the electron zip from https://github.com/electron/electron/releases/download/v7.1.7/electron-v7.1.7-darwin-x64.zip
Step 3. copy the zip to /electron/dist
Step 4. vi ./node_modules/electron/path.txt and input /electron-v7.1.7-darwin-x64/Electron.app/Contents/MacOS/Electron

Finaly, you can run npm start.

But, it is not a good way to start electron.

I have tried to follow most of the guidelines and everything installs correctly but I still get the same issue.

If you are Chinese the following instructions may be useful to you.

  1. Open your chrome and paste the url https://github.com/electron/electron/releases/download/v7.1.7/electron-v7.1.7-darwin-x64.zip, you should change the version to correct version and this url based on macOS if your are Windows try debug install.js get the correct url

  2. Save the zip to any folder, for example, Desktop. Now your zip file path is /Users/yourname/Desktop/electron-v7.1.7-darwin-x64.zip. Note the version

  3. Open then node_modules/electron/install.js comment the following code, and add new line :

    extractFile(myPath in the second step)

// downloads if not cached
// downloadArtifact({
//   version,
//   artifactName: 'electron',
//   force: process.env.force_no_cache === 'true',
//   cacheRoot: process.env.electron_config_cache,
//   platform: process.env.npm_config_platform || process.platform,
//   arch: process.env.npm_config_arch || process.arch
// }).then((zipPath) => extractFile(zipPath)).catch((err) => onerror(err))
// Node: the new line
extractFile(myPath in the second step)
  1. Run install.js node install.js
  2. Run start script of your project : npm start

最好的方法还是使用淘宝镜像:
根目录下新建一个.npmrc文件, 文件内容

electron-mirror=https://npm.taobao.org/mirrors/electron/
electron-custom-dir=8.0.2
// 下面这个是我自己用到的.. 上面两个是针对electron的
node-sqlite3_binary_host_mirror=https://npm.taobao.org/mirrors/

版本根据自己的需求来

Solved on raspberry Pi4 with:
npm i -D electron --arch=armv7l

If you use webpack to build project, you should add electron to the externals of your webpack config .

on Mac after installing electron, try:

sudo node /node_modules/electron/install.js

*sudo required

@justgeek,

This solved my issue:
https://stackoverflow.com/questions/42636151/electron-failed-to-install-correctly-please-delete-node-modules-and-try-instal

npm install electron-prebuilt --save-dev

Seems that you have to have a version of pre-built electron installed in same project.

Your suggestion solved my issue. But do we need to install both Electron@latest and [email protected] ??

Personally, I tried all suggestions here and nothing seemed to get past this issue. I'm on a mac and it could be a proxy issue on my end.

On windows , I was just trying out electron for the first time, went through the official docs and couldn't even run the quick-start app due to the same error, tried a lot of fixes nothing works. Going to manually copy-paste the .zip provided : (

Node install.js was failing due to permissions for me so the following solved my issue.

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

No need to download prebuilt binaries or older versions of electron.

Give it a try. 🤓
https://github.com/pangxieju/electron-fix

thanks! It maked my project worked!

Give it a try. 🤓 Open https://github.com/pangxieju/electron-fix

1、$ npm install electron-fix -D

2、Edit file ‘package.json’
"scripts": {
"fix": "electron-fix start"
}

3、npm run fix

For those who aren't downloading from Hong Kong and still haven't figured out the issue, I finally noticed one of the comments in this long chain.

When I ran npm i electron -g --verbose, I noticed the following line:

npm info lifecycle [email protected]~postinstall: ignored because ignore-scripts is set to true [email protected]

Doing the following fixed my issue:

I don't understand enough about npm to debug the underlying issue but it seems that the Electron API Demo App is not successfully running the "postinstall": "node install.js" task. This postinstall task does get listed when running npm install --verbose but it doesn't seem to run.
After installing, I have to manually run node node_modules/electron/install.js

Since i installed globally, I used the install.js located in the global install directory, ./AppData/Roaming/npm/

Looks like you're having some network issues (which are out of our control 😢 )

You can download the ZIP file manually in your browser from here and place it in your C:\Users\<username>\.electron folder. Then it won't need to download itself 👍

While I did not have any network issues, the issue was due to a faulty electron installation when npm install was run for the first time. Just deleted .electron-gyp folder in C:\Users\ folder and issued nom install ad then it worked.

the modules dir include install.js, run and install it, the path.txt is written. It works

what's the details of this step

Was this page helpful?
0 / 5 - 0 ratings