坑-please delete node_modules/electron and try installing again

5 阅读1分钟

问题

node_modules\.pnpm\electron@40.6.1\node_modules\electron\index.js:17
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

开发的时候pnpm install 突然报错 无论怎么安装electron 都是正确的 但是运行的时候就报上面错误

查了老半天才发现问题所在

解决

强制下载源

set ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/

set ELECTRON_CACHE=%USERPROFILE%\.electron_cache

然后到 node_modules里找到electron 里的 install.js 手动执行即可

end

在ai时代坚持记录只为了给那个找不到解决方案的你。

总结

坚持记录