electron下载失败npm ERR! code 1

electron下载失败npm ERR! code 1

Ezra
2023-07-15 / 0 评论 / 146 阅读 / 正在检测是否收录...

npm安装electron时,卡在出现以下问题:

npm ERR! code 1
npm ERR! path E:\node-project\genshin-wish-export-main\node_modules\electron
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node install.js
npm ERR! RequestError: read ECONNRESET
npm ERR!     at ClientRequest.<anonymous> (E:\node-project\genshin-wish-export-main\node_modules\got\source\request-as-event-emitter.js:178:14)
npm ERR!     at Object.onceWrapper (node:events:628:26)
npm ERR!     at ClientRequest.emit (node:events:525:35)
npm ERR!     at origin.emit (E:\node-project\genshin-wish-export-main\node_modules\@szmarczak\http-timer\source\index.js:37:11)
npm ERR!     at TLSSocket.socketErrorListener (node:_http_client:502:9)
npm ERR!     at TLSSocket.emit (node:events:513:28)
npm ERR!     at emitErrorNT (node:internal/streams/destroy:151:8)
npm ERR!     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Ezra\AppData\Local\npm-cache\_logs\2023-07-15T04_54_11_729Z-debug-0.log

因为electron的安装并不依赖本地npm中registry所配置的镜像,需要增加名称为electron_mirror的镜像源,修改~/.npmrc,添加electron_mirror=https://npm.taobao.org/mirrors/electron/即可
lk3js63m.png
使用命令 npm config edit 即可打开文件

1

评论 (0)

取消