【Electron】electron-builder打包过程中报错: A connection attempt failed—connected host has failed to respond

学习项目使用的是vue3+typescript+vite+electron,npm run build 打包报错信息如下:

Get “https://github.com/electronXXXX”: dial tcp XXXX: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

【Electron】electron-builder打包过程中报错: A connection attempt failed—connected host has failed to respond_第1张图片

报错原因

这个主要是因为在打包的过程中,会从github下载一些依赖包,但是由于国内网络种种原因,我们无法正常下载这个些文件,导致下载依赖报错。比如electron-builder打包过程中会涉及到四个包:

  1. electron-v28.1.4-win32-x64
  2. winCodeSign-2.6.0
  3. nsis-3.0.4.1
  4. nsis-resources-3.4.1

解决方法

上述四个压缩包在GitHub可以直接手动下载https://github.com/electron-userland/electron-builder-binaries/releases
也可以在我上传的文件位置下载https://download.csdn.net/download/weixin_42960907/88778120

下载压缩包之后,放到指定位置:在C:\Users\你的名字\AppData\Localelectronelectron-builder中(需要自己手动解压缩)
如图所示:
1.electron-v28.1.4-win32-x64存放位置
【Electron】electron-builder打包过程中报错: A connection attempt failed—connected host has failed to respond_第2张图片
2. winCodeSign-2.6.0存放位置【Electron】electron-builder打包过程中报错: A connection attempt failed—connected host has failed to respond_第3张图片

  1. nsis-3.0.4.1存放位置(见下图)
  2. nsis-resources-3.4.1存放位置(见下图)
    【Electron】electron-builder打包过程中报错: A connection attempt failed—connected host has failed to respond_第4张图片

【视频——Vue3 Vite electron 开发桌面程序】https://www.bilibili.com/video/BV1dS4y1y7vd?p=54&vd_source=46ff36b24b96386dd704c889b6366491
【文章——Vue3 Vite electron 开发桌面程序】https://blog.csdn.net/qq1195566313/article/details/131713875

【electron-builder打包过程中报错——网络下载篇】https://blog.csdn.net/syj573077027/article/details/123610805

你可能感兴趣的:(electron,electron,javascript,前端)