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

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 (D:\AppServ\www\electron-project\practice\node_modules_electron@5.0.8@electron\index.js:14:11)
at Object. (D:\AppServ\www\electron-project\practice\node_modules_electron@5.0.8@electron\index.js:18:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions…js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (D:\AppServ\www\electron-project\practice\node_modules_electron@5.0.8@electron\cli.js:3:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-quick-start@1.0.0 start: electron .
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-quick-start@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\Administrator\AppData\Roaming\npm-cache_logs\2019-07-28T15_39_25_139Z-debug.log

可能存在两种情况

  1. 需要删除node_modules/electron的安装包,然后再重新npm install,重新安装包即可。

  2. 如果第一种方法常识无效,那么很可能是相关依赖包没有完全下载完全,建议删除node_modules后再使用yarn来下载依赖包,步骤如下:

    1. 删除node_modules
    2. 安装全局yarn: npm install yarn -g
    3. 安装项目依赖: yarn install
    4. 安装electron: yarn install electron --save
    5. 重新启动程序: electron .

如图:在这里插入图片描述

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值