electron安装失败,淘宝镜像也失败的解决方案

当 Electron 最新版本安装失败,包括使用淘宝镜像也遇到问题时,可以尝试从npm官网查找并安装一个历史版本。通过选择非最新的版本号进行安装,问题通常能得到解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最新版本可能存在问题。这种情况要去npm官网查看electron的版本记录选择一个不是最新的版本进行安装。:

这里我是:然后成功了

cnpm install -g electron@3.1.0

 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:\electronjsTest\node_modules\_electron@7.0.0@electron\index.js:14:11)
    at Object.<anonymous> (E:\electronjsTest\node_modules\_electron@7.0.0@electron\index.js:18:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (E:\electronjsTest\node_modules\_electron@7.0.0@electron\cli.js:3:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@1.0.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@1.0.0 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!     C:\Users\14140\AppData\Roaming\npm-cache\_logs\2019-10-23T07_43_39_353Z-debug.log

√ Installed 1 packages
√ Linked 54 latest versions
[1/1] scripts.postinstall electron@^7.0.0 run "node install.js", root: "E:\\electronjsTest\\node_modules\\_electron@7.0.0@electron"
(node:18144) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, lstat 'C:\Users\14140\AppData\Local\Temp\electron-download-u63FpX\electron-v7.0.0-win32-x64.zip'
(node:18144) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18144) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[1/1] scripts.postinstall electron@^7.0.0 finished in 3s
√ Run 1 scripts
Recently updated (since 2019-10-16): 2 packages (detail see file E:\electronjsTest\node_modules\.recently_updates.txt)
  Today:
    → electron@7.0.0 › @types/node@^12.0.12(12.11.5) (05:00:56)
√ All packages installed (59 packages installed from npm registry, used 5s(network 2s), speed 82.07kB/s, json 55(136.4kB), tarball 0B)

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值