第2世界
发布于 2024-12-09 / 6 阅读 / 0 评论 / 0 点赞

electron项目镜像配置

直接npm i提示错误:

npm ERR! code 1
npm ERR! path /Users/liukun/Desktop/rygl/node_modules/electron
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! HTTPError: Response code 404 (Not Found)
npm ERR!     at Request._onResponseBase (/Users/liukun/Desktop/rygl/node_modules/got/dist/source/core/index.js:913:31)
npm ERR!     at Request._onResponse (/Users/liukun/Desktop/rygl/node_modules/got/dist/source/core/index.js:948:24)
npm ERR!     at ClientRequest.<anonymous> (/Users/liukun/Desktop/rygl/node_modules/got/dist/source/core/index.js:962:23)
npm ERR!     at Object.onceWrapper (node:events:628:26)
npm ERR!     at ClientRequest.emit (node:events:525:35)
npm ERR!     at origin.emit (/Users/liukun/Desktop/rygl/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
npm ERR!     at HTTPParser.parserOnIncomingClient (node:_http_client:701:27)
npm ERR!     at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
npm ERR!     at Socket.socketOnData (node:_http_client:542:22)
npm ERR!     at Socket.emit (node:events:513:28)

解决办法,npm config edit,添加配置:

registry=https://registry.npmmirror.com
electron_mirror=https://cdn.npmmirror.com/binaries/electron/
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/


评论