当前位置: 首页 > news >正文

electron安装失败

安装electron

//指定版本可以改为 npm install --save-dev electron@22.3.0
npm install --save-dev electron

安装失败 RequestError: connect ETIMEDOUT 20.205.243.166:443

npm error code 1
npm error path E:\project\work\xxx\xxx\node_modules\electron
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
npm error RequestError: connect ETIMEDOUT 20.205.243.166:443
npm error     at ClientRequest.<anonymous> (E:\project\work\xxx\xxx\node_modules\got\dist\source\core\index.js:970:111)
npm error     at Object.onceWrapper (node:events:623:26)
npm error     at ClientRequest.emit (node:events:520:35)
npm error     at origin.emit (E:\project\work\xxx\xxx\node_modules\@szmarczak\http-timer\dist\source\index.js:43:20)
npm error     at emitErrorEvent (node:_http_client:107:11)
npm error     at TLSSocket.socketErrorListener (node:_http_client:574:5)
npm error     at TLSSocket.emit (node:events:508:28)
npm error     at emitErrorNT (node:internal/streams/destroy:170:8)
npm error     at emitErrorCloseNT (node:internal/streams/destroy:129:3)
npm error     at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
npm error     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16)
npm error A complete log of this run can be found in: C:\Users\xxx\AppData\Local\npm-cache\_logs\2025-09-08T10_00_30_300Z-debug-0.log
解决:
  • 安装 pnpm
npm install -g pnpm
  • 安装 pnpm 失败,执行如下命令
npm install -g pnpm --registry=https://registry.npmmirror.com
  • 或者设置pnpm使用国内镜像源(配置后建议关闭终端后再重新打开新的终端)
pnpm config set registry https://registry.npmmirror.com
  • 查看当前的 registry 镜像
npm config get registry
  • 或者在根目录配置 .npmrc 文件,可以确保大部分走国内镜像
  • 内容如下
registry=https://registry.npmmirror.com
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/
PUPPETEER_DOWNLOAD_HOST=https://npmmirror.com/mirrors
  • 如果无法安装pnpm,考虑下载最新版 Node.js
  • pnpm 来安装 electron
pnpm install electron --save-dev
  • 安装继续失败报错:ssh: connect to host github.com port 22: Connection timed out

  • 配置Git对GitHub使用HTTPS协议

  • 一定要加 --add 不然会被覆盖

# 配置Git对GitHub使用HTTPS协议
# 这将使Git在获取GitHub仓库时使用HTTPS而不是SSH
git config --global --add url."https://github.com/".insteadOf git@github.com:# 或者专门针对GitHub配置
git config --global --add url."https://github.com/".insteadOf ssh://git@github.com/
  • 配置后用如下命令检查是否设置成功
git config --global --list
  • 你应该看到 两条规则:
url.https://github.com/.insteadof=ssh://git@github.com/
url.https://github.com/.insteadOf=git@github.com:
  • git配置成功后一定要关闭当前的终端,重新开一个终端,再去安装 electron
npm install#或者
pnpm install#等等命令
...

文章转载自:

http://6mc9K9dd.mLnby.cn
http://9yAQqq53.mLnby.cn
http://4OQTqtx2.mLnby.cn
http://swoGEkhP.mLnby.cn
http://Xt4PATnP.mLnby.cn
http://9sK96mgU.mLnby.cn
http://Vv6ApPvY.mLnby.cn
http://Yepxar7u.mLnby.cn
http://ulSPoJxt.mLnby.cn
http://wgsScikn.mLnby.cn
http://7NMVm9aP.mLnby.cn
http://MwNKwJZL.mLnby.cn
http://FMjSXCKx.mLnby.cn
http://7K24if0x.mLnby.cn
http://3pjo06OK.mLnby.cn
http://1EgM0Inj.mLnby.cn
http://knnCWHgA.mLnby.cn
http://gPFdbqHv.mLnby.cn
http://K7s4Pbsu.mLnby.cn
http://ih1cGwq4.mLnby.cn
http://P17dyTqE.mLnby.cn
http://0ff49AUX.mLnby.cn
http://6L39hq8O.mLnby.cn
http://7dgS7oFO.mLnby.cn
http://Z09OG48K.mLnby.cn
http://U3Z7zoHS.mLnby.cn
http://JtVAvPZD.mLnby.cn
http://DrpB2qVu.mLnby.cn
http://7eCWNfuF.mLnby.cn
http://ff3vTSpd.mLnby.cn
http://www.dtcms.com/a/374539.html

相关文章:

  • Electron+Vite+Vue项目中,如何监听Electron的修改实现和Vue一样的热更新?[特殊字符]
  • IEEE出版,限时早鸟优惠!|2025年智能制造、机器人与自动化国际学术会议 (IMRA 2025)
  • Next.js vs Create React App:2025年该如何选择?
  • React From表单使用Formik和yup进行校验
  • 响应式编程思想与 Reactive Streams 规范
  • [react] react onClick函数的认知陷阱
  • Vue3 + Vite + Element Plus web转为 Electron 应用
  • 【算法】四大基础数据结构
  • ARM-汇编的基础知识
  • 【C++】19. 封装红⿊树实现set和map
  • 多目标轮廓匹配
  • 立即数、栈、汇编与C函数的调用
  • 人大金仓:merge sql error, dbType null, druid-1.2.20
  • leetcode 面试题01.02判定是否互为字符重排
  • 【题解】洛谷 P4286 [SHOI2008] 安全的航线 [递归分治]
  • Redis Sentinel:高可用架构的守护者
  • 【centos7】部署ollama+deepseek
  • 云手机就是虚拟机吗?
  • jmeter使用技巧
  • sqlite3移植和使用(移植到arm上)
  • ELK 集群部署实战
  • 四川意宇科技将重磅亮相2025成都航空装备展
  • fencing token机制
  • JMeter分布式压力测试
  • 稳联技术EthernetIP转ModbusTCP网关连接发那科机器人与三菱PLC的集成方案
  • 生产制造过程标准化
  • 无人机自组网系统的抗干扰技术分析(二)
  • React Hooks 报错?一招解决useState问题
  • MacBook logback日志输出到绝对路径
  • vue3中 ref() 和 reactive() 的区别