electron开发:throw new Error(‘Electron failed to install correctly, please delete node_modules/electron and try installing again’);

前言 最近开发QQ机器人遇到electron报错: E:\study\aicode\publish\qqbot […]

前言

最近开发QQ机器人遇到electron报错:

E:\study\aicode\publish\qqbot-v3\web\node_modules\.pnpm\electron@22.3.27\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
    at getElectronPath (E:\study\aicode\publish\qqbot-v3\web\node_modules\.pnpm\electron@22.3.27\node_modules\electron\index.js:17:11)
    at Object.<anonymous> (E:\study\aicode\publish\qqbot-v3\web\node_modules\.pnpm\electron@22.3.27\node_modules\electron\index.js:21:18)
    at Module._compile (node:internal/modules/cjs/loader:1734:14)
    at Object..js (node:internal/modules/cjs/loader:1899:10)
    at Module.load (node:internal/modules/cjs/loader:1469:32)
    at Module._load (node:internal/modules/cjs/loader:1286:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at cjsLoader (node:internal/modules/esm/translators:315:5)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:207:7)

解决方法

pnpm config set electron_mirror https://npmmirror.com/mirrors/electron/
rimraf .\node_modules\   
pnpm store prune
pnpm install

 

版权声明
文章标题:electron开发:throw new Error(‘Electron failed to install correctly, please delete node_modules/electron and try installing again’);
文章链接:https://blog.chiyuba.com/houduanjishu/636.html
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布,转载或引用请注明出处。
温馨提示:本文最后更新于 2026年4月20日,部分内容可能存在时效性,请注意甄别。

相关推荐

更多教程

评论