描述
在安装electron时出现以下报错:PS D:\dev\electron> yarn add electron concurrently cross-env electron-builder -D yarn add v1.22.19 info No lockfile found. [1/4] Resolving packages... warning electron-builder > app-builder-lib > [email protected]: Please use @electron/osx-sign moving forward. Be aware the API is slightly different [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... error D:\dev\electron\node_modules\electron: Command failed. Exit code: 1 Command: node install.js Arguments: Directory: D:\dev\electron\node_modules\electron Output: RequestError: connect ETIMEDOUT 20.205.243.166:443 at ClientRequest.<anonymous> (D:\dev\electron\node_modules\got\source\request-as-event-emitter.js:178:14) at Object.onceWrapper (node:events:628:26) at ClientRequest.emit (node:events:525:35) at origin.emit (D:\dev\electron\node_modules\@szmarczak\http-timer\source\index.js:37:11) at TLSSocket.socketErrorListener (node:_http_client:494:9) at TLSSocket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
解决方式
20.205.243.166该地址是github的地址,由于在国内无法访问。 方式一: 比如更改主机host,访问github。 方式二: 更改electron安装源。 yarn设置:yarn config set electron_mirror https://npmmirror.com/mirrors/electron/npm设置
npm config set ELECTRON_MIRROR https://npmmirror.com/mirrors/electron/以下为官方说明:
2022-8-31 15:12:41
评论区