终端出现提示“Electron failed to install correctly”
当安装完成,运行项目时,终端上出现以下错误:
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
问题原因
安装过程看似很快就完成了,没报任何错误,而实际上 Electron 安装失败,只生成了 node_modules/electron 目录,目录中的文件不完整,脚本中的 "path.txt" 也不存在,导致运行时抛出异常。
解决方法
方式一:设置 electron 安装镜像,重新安装;
方式二:临时镜像地址安装:
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm install electron -D --arch=ia32