You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Electron Builder构建失败:无法从GitHub下载包求助

Electron-Builder构建失败(代理连接错误)

运行electron-builder配合electron-updater时,每次构建操作均失败,错误核心为无法下载指定版本的Electron包,提示代理连接地址无效。已尝试更换多个electron-builder及Electron版本,问题仍未解决。

错误日志

• electron-builder  version=23.6.0 os=10.0.19044
  • loaded configuration  file=package.json ("build" field)
  • description is missed in the package.json  appPackageFile=C:\Users\ZRGH5903.AD\Desktop\Documentation\Angular\snapface\package.json
  • writing effective config  file=newbuild\builder-effective-config.yaml
  • packaging       platform=win32 arch=x64 electron=23.2.0 appOutDir=newbuild\win-unpacked
 ` ⨯ Get "https://github.com/electron/electron/releases/download/v23.2.0/electron-v23.2.0-win32-x64.zip": proxyconnect tcp: dial tcp :0: connectex: The requested address is not valid in its context.`
github.com/develar/app-builder/pkg/download.(*Downloader).follow.func1
        /Volumes/data/Documents/app-builder/pkg/download/downloader.go:206
github.com/develar/app-builder/pkg/download.(*Downloader).follow
        /Volumes/data/Documents/app-builder/pkg/download/downloader.go:234
github.com/develar/app-builder/pkg/download.(*Downloader).DownloadNoRetry
        /Volumes/data/Documents/app-builder/pkg/download/downloader.go:128
github.com/develar/app-builder/pkg/download.(*Downloader).Download
        /Volumes/data/Documents/app-builder/pkg/download/downloader.go:112
github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).doDownload
        /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:192
github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).Download
        /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:177
github.com/develar/app-builder/pkg/electron.downloadElectron.func1.1
        /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:73
github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func2
        /Volumes/data/Documents/app-builder/pkg/util/async.go:68
runtime.goexit
        /usr/local/Cellar/go/1.17/libexec/src/runtime/asm_amd64.s:1581  
  ⨯ C:\Users\ZRGH5903.AD\Desktop\Documentation\Angular\snapface\node_modules\app-builder-bin\win\x64\app-builder.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1  failedTask=build stackTrace=Error: C:\Users\ZRGH5903.AD\Desktop\Documentation\Angular\snapface\node_modules\app-builder-bin\win\x64\app-builder.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
    at ChildProcess.<anonymous> (C:\Users\ZRGH5903.AD\Desktop\Documentation\Angular\snapface\node_modules\builder-util\src\util.ts:250:14)
    at Object.onceWrapper (node:events:642:26)
    at ChildProcess.emit (node:events:527:28)
    at ChildProcess.cp.emit (C:\Users\ZRGH5903.AD\Desktop\Documentation\Angular\snapface\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

解决方案

  • 清理代理配置

    1. 检查系统代理设置,若端口设为0或配置异常,直接关闭系统代理
    2. 清理npm/yarn的代理配置:
      npm config delete proxy
      npm config delete https-proxy
      yarn config delete proxy
      yarn config delete https-proxy
      
  • 手动指定Electron包来源

    1. 手动下载对应版本的Electron包(如v23.2.0-win32-x64.zip)
    2. 通过环境变量指定缓存路径或国内镜像:
      # Windows命令行设置缓存路径
      set ELECTRON_CACHE=C:\your\local\electron\cache\path
      # 或使用国内镜像加速
      set ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
      
  • 检查安全软件拦截
    临时关闭防火墙、杀毒软件,确认是否是安全工具拦截了下载请求

  • 修复package.json警告
    补充package.json中缺失的description字段,避免潜在配置问题:

    {
      "description": "你的应用描述"
    }
    

内容的提问来源于stack exchange,提问作者ibtissam ol

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 18:22:44