Electron RequestError: connect ETIMEDOUT 20.205.243.166:443

问题描述
下载 electron 时,卡在了下载超时,换 github.com ip 无效、用梯子无效,直到官网这里找到了原因:

Mirror
You can use environment variables to override the base URL, the path at which to look for Electron binaries, and the binary filename. The URL used by @electron/get is composed as follows:

url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + '/' + ELECTRON_CUSTOM_FILENAME
1
For instance, to use the China CDN mirror:

ELECTRON_MIRROR="https://cdn.npm.taobao.org/dist/electron/"
1
解决办法
1、找国内镜像,比如npmmirror 中国镜像站:

electron 镜像: https://npmmirror.com/mirrors/electron/
1
2、设置:

# yarn
yarn config set electron_mirror https://npmmirror.com/mirrors/electron/

# npm
npm config set ELECTRON_MIRROR https://npmmirror.com/mirrors/electron/
1
2
3
4
5
或者配置 npmrc
在项目根目录新建 .npmrc,内容:

electron_mirror=https://npmmirror.com/mirrors/electron/
————————————————
版权声明:本文为CSDN博主「大涛子」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_42840269/article/details/124094975

posted on 2022-10-12 18:04  龍瀧尨呀  阅读(3490)  评论(0编辑  收藏  举报

导航