electron-builder打包时github包下载失败【解决办法】

各位朋友们,在使用electron开发时,选择了electron-builder作为编译打包工具时,是否经常遇到无法从github上下载依赖包问题,如下报错:

Get "https://github.com/electron/electron/releases/download/v6.1.12/electron-v6.1.12-win32-ia32.zip": dial tcp 20.205.243.166:443: 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.
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

报错截图:

原因就是github被墙,无法访问导致。

那么,解决办法也很简单:

1、找到可替代github的镜像,从这里手动下载对应zip包,推荐一个:https://github.xzc888.top

把github域名替换为上述镜像域名,如图:

https://github.com/electron/electron/releases/download/v6.1.12/electron-v6.1.12-win32-ia32.zip
替换为:
https://github.xzc888.top/electron/electron/releases/download/v6.1.12/electron-v6.1.12-win32-ia32.zip

然后访问,完成下载,如图:

2、下载到zip包后,放到对应目录下:C:\Users\{username}\AppData\Local\electron\Cache

把下载后的zip包拷贝到目上述目录下,如图:

3、再次运行打包即可

备注:一点一滴,皆是成果!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值