You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我这边已经按照提示删除依赖重新安装 ,结果还是一直报这个错误
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 (E:\学习资料\前端材料\设计模式\code\nodeJS脚本\npm-login\node_modules_electron@7.1.0@electron\index.js:14:11)
at Object. (E:\学习资料\前端材料\设计模式\code\nodeJS脚本\npm-login\node_modules_electron@7.1.0@electron\index.js:18:18)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
at Function.Module._load (internal/modules/cjs/loader.js:703:12)
at Module.require (internal/modules/cjs/loader.js:830:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object. (E:\学习资料\前端材料\设计模式\code\nodeJS脚本\npm-login\node_modules_electron@7.1.0@electron\cli.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:936:30)
Legends, bipsBro, ghuser, tjx666, ilyaKho and 5 more
We require the template to be filled out on all new issues and pull requests. We do this so that we can be certain we have all the information we need to address your submission efficiently. This allows the maintainers to spend more time fixing bugs, implementing enhancements, and reviewing and merging pull requests. We will be able to more closely look at your issue once you do so.
Same here.
Was working perfectly for me a week ago.
Could it be the new version?
I noticed that the 'dist' folder is not within the 'node_modules/electron' directory.
Would it be safe if I copy that folder from one of my old projects to the new one?
Same error here if I try to install electron v7.1.2.
I'm also behind a corporate/proxy firewall.
Idea from @xland is working. However, I installed electron on my private pc and then copied it (".\node_modules\electron") to the other pc. :)
@malept sorry for the weird proxy problem. i rebooted my computer and the proxy problem is gone now and got can utilize proxy correctly.
i tried set DEBUG=@electron/get:* and set DEBUG=got:* for two independent yarn add xxx , electron is still broken and there are not any logs related to @electron/get and got module in the standard output console.
open cmd windows, set variable
if with cmd set ELECTRON_MIRROR=https://cdn.npm.taobao.org/dist/electron/ (without quote)
if with powershell $Env:ELECTRON_MIRROR="https://cdn.npm.taobao.org/dist/electron/"
option, set DEBUG will display download detail set DEBUG=@electron/get:* (cmd) or $env:DEBUG="@electron/get:*" (powershell)
D:\code\electron-quick-start>npm i
> core-js@3.6.4 postinstall D:\code\electron-quick-start\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> electron@8.1.0 postinstall D:\code\electron-quick-start\node_modules\electron
> node install.js
@electron/get:index Checking the cache (undefined) for electron-v8.1.0-win32-ia32.zip (https://cdn.npm.taobao.org/dist/electron/v8.1.0/electron-v8.1.0-win32-ia32.zip) +0ms
@electron/get:index Cache miss +6ms
@electron/get:index Downloading https://cdn.npm.taobao.org/dist/electron/v8.1.0/electron-v8.1.0-win32-ia32.zip to C:\Users\dong\AppData\Local\Temp\electron-download-qz5JpG\electron-v8.1.0-win32-ia32.zip with options: undefined +71ms
@electron/get:index Checking the cache (undefined) for SHASUMS256.txt (https://cdn.npm.taobao.org/dist/electron/v8.1.0/SHASUMS256.txt) +10s
@electron/get:index Cache miss +4ms
@electron/get:index Downloading https://cdn.npm.taobao.org/dist/electron/v8.1.0/SHASUMS256.txt to C:\Users\dong\AppData\Local\Temp\electron-download-FFll6C\SHASUMS256.txt with options: undefined +3ms
@electron/get:cache Moving C:\Users\dong\AppData\Local\Temp\electron-download-FFll6C\SHASUMS256.txt to C:\Users\dong\AppData\Local\electron\Cache\httpscdn.npm.taobao.orgdistelectronv8.1.0SHASUMS256.txt\SHASUMS256.txt +0ms
@electron/get:cache Moving C:\Users\dong\AppData\Local\Temp\electron-download-qz5JpG\electron-v8.1.0-win32-ia32.zip to C:\Users\dong\AppData\Local\electron\Cache\httpscdn.npm.taobao.orgdistelectronv8.1.0electron-v8.1.0-win32-ia32.zip\electron-v8.1.0-win32-ia32.zip +609ms
npm notice created a lockfile as package-lock.json. You should commit this file.
added 86 packages from 96 contributors and audited 103 packages in 24.455s
2 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Maybe the high version of electron's script modify the default dir.
with low version of electron, npm.taobao.org... maybe worked instead of cdn.npm.taobao.org...
Activity
codebytere commentedon Nov 7, 2019
We require the template to be filled out on all new issues and pull requests. We do this so that we can be certain we have all the information we need to address your submission efficiently. This allows the maintainers to spend more time fixing bugs, implementing enhancements, and reviewing and merging pull requests. We will be able to more closely look at your issue once you do so.
Legends commentedon Nov 10, 2019
Won't install electron, it hangs ♾️
The error message actually occurs when you cancel the hanging install and nevertheless try to run the project.
695750180 commentedon Nov 11, 2019
Follow your approach ,It's the same problem @Legends but reduced version can be used. I use 6.x version。
Legends commentedon Nov 12, 2019
@codebytere Do you need more information?
wtoalabi commentedon Nov 12, 2019
Same here.
Was working perfectly for me a week ago.
Could it be the new version?
I noticed that the 'dist' folder is not within the 'node_modules/electron' directory.
Would it be safe if I copy that folder from one of my old projects to the new one?
Thanks.
xland commentedon Nov 20, 2019
@695750180
@wtoalabi
path.txt
innode_modules\electron
folder.electron.exe
in it.node_modules\electron\dist
BetaMee commentedon Nov 24, 2019
it is OK for Mac, create file
path.txt
, and addElectron.app/Contents/MacOS/Electron
in that file.borsTiHD commentedon Nov 30, 2019
Same error here if I try to install electron v7.1.2.
I'm also behind a corporate/proxy firewall.
Idea from @xland is working. However, I installed electron on my private pc and then copied it (".\node_modules\electron") to the other pc. :)
hgt803 commentedon Dec 18, 2019
我是这样重现该问题的,求解决
HarwordLiu commentedon Dec 20, 2019
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.
Kramy commentedon Dec 20, 2019
On Linux:
I was getting this error while installing electron because i had no acces to modify "/home/{user}/.cache/electron" directory.
Removing that directory and reinstalling electron worked to me.
18 remaining items
bruceauyeung commentedon Mar 6, 2020
@malept
got
didn't respect my proxy settingsmalept commentedon Mar 6, 2020
The installation docs contains instructions on how to configure proxy support.
bruceauyeung commentedon Mar 6, 2020
@malept sorry for the weird proxy problem. i rebooted my computer and the proxy problem is gone now and
got
can utilize proxy correctly.i tried
set DEBUG=@electron/get:*
andset DEBUG=got:*
for two independentyarn add xxx
, electron is still broken and there are not any logs related to@electron/get
andgot
module in the standard output console.malept commentedon Mar 6, 2020
It's not clear that you're setting the
DEBUG
environment variable correctly. See thedebug
documentation for details.Also,
got
does not use thedebug
module, soDEBUG=got:*
won't do anything useful.xland commentedon Mar 7, 2020
@bruceauyeung
try:
yarn config set ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/
sincerefly commentedon Mar 7, 2020
I solved.
if with cmd
set ELECTRON_MIRROR=https://cdn.npm.taobao.org/dist/electron/
(without quote)if with powershell
$Env:ELECTRON_MIRROR="https://cdn.npm.taobao.org/dist/electron/"
option, set DEBUG will display download detail
set DEBUG=@electron/get:*
(cmd) or$env:DEBUG="@electron/get:*"
(powershell)yarn
ornpm i
thanks @malept @bruceauyeung @youngyou
xland commentedon Mar 7, 2020
@sincerefly
Are you sure the address is correct?
https://cdn.npm.taobao.org/dist/electron/
This address response:
I think it should be
https://npm.taobao.org/mirrors/electron
sincerefly commentedon Mar 7, 2020
@xland
Yes, I test it.
Try:
https://cdn.npm.taobao.org/dist/electron/v8.1.0/electron-v8.1.0-win32-ia32.zip
and npm install detail:
sincerefly commentedon Mar 7, 2020
@xland
Suggest use
https://cdn.npm.taobao.org/dist/electron/
with current electron versionWith
https://cdn.npm.taobao.org/dist/electron/
, you should settingELECTRON_CUSTOM_DIR
eg:
Beacuse the dist url dist is different
Maybe the high version of electron's script modify the default dir.
with low version of electron,
npm.taobao.org...
maybe worked instead ofcdn.npm.taobao.org...
pangxieju commentedon Mar 7, 2020
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
xland commentedon Mar 7, 2020
@sincerefly
Thanks ,I'll try it later.
bruceauyeung commentedon Mar 7, 2020
@malept i set
DEBUG
as windows environment variable,set DEBUG=@electron/get:*
is the command what i run before runningyarn add xxx
bo-er commentedon Mar 31, 2021
qhan1028 commentedon Aug 28, 2021
try add this env variable
ELECTRON_OVERRIDE_DIST_PATH=./node_modules/electron/dist