Electron打包報(bào)錯(cuò)及electron-v27.1.2-win32-x64.zip下載慢的問(wèn)題處理
? Get "https://github.com/electron/electron/releases/download/v27.1.2/electron-v27.1.2-win32-x64.zip": read tcp 192.168.1.3:50598->20.205.243.166:443: wsarecv: A connection attempt failed because the connected party did not pro perly 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 runtime.goexit /usr/local/Cellar/go/1.17/libexec/src/runtime/asm_amd64.s:1581 ? C:\Users\Administrator\AppData\Roaming\npm\node_modules\electron-builder\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\Administrator\AppData\Roaming\npm\node_modules\electron-builder\node_modules\app-builder-bin\win\x64\app-builder.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE Exit code:
以上報(bào)錯(cuò)使用的是 build 打包,需要手動(dòng)安裝 /electron-v27.1.2-win32-x64.zip文件
"scripts": { "start": "electron .", "packagewin": "electron-packager ./ spapi --platform=win32 --out=./dist --arch=x64 --app-version=1.0.0 --icon=./static/login.ico --overwrite", "build": "electron-builder" },
需要packagewin需要安裝electron-packager
npm install -g electron-packager
太麻煩了,然后我想使用 packagewin方法打包 會(huì)自動(dòng)安裝electron-v27.1.2-win32-x64.zip包,但是問(wèn)題是 安裝太慢
在網(wǎng)站找了下資料 說(shuō)是鏡像下就可以了,這樣下載快些了,但是還是用了我5分鐘
npm config set registry https://registry.npm.taobao.org/
打開(kāi)hosts文件
192.168.1.3:50598->20.205.243.166:443 改 0 0 0 0 github.com
更新DNS緩存
ipconfig /flushdns
[聲明]原創(chuàng)不易,請(qǐng)轉(zhuǎn)發(fā)者備注下文章來(lái)源(hbsjsd.cn)【速建時(shí)代】。