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   龍瀧尨呀  阅读(4384)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示