electron-builder --win --ia32 打包过程问题记录

499 阅读3分钟

问题记录

本次打包失败的主要是网络原因,导致相关的依赖包下载失败

问题1:下载依赖包winCodeSign-2.6.0失败

F:\EH\xxx\xxx\app> npm run dist-win32

> weavebird@2.0.2 dist-win32
> electron-builder --win --ia32

  • electron-builder  version=23.6.0 os=10.0.25997
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=build\builder-effective-config.yaml
  • packaging       platform=win32 arch=ia32 electron=25.1.1 appOutDir=build\win-ia32-unpacked
  • asar usage is disabled — this is strongly not recommended  solution=enable asar and use asarUnpack to unpack files that must be externally available
  • asar usage is disabled — this is strongly not recommended  solution=enable asar and use asarUnpack to unpack files that must be externally available
  ⨯ Get "https://objects.githubusercontent.com/github-production-release-asset-2e65be/65527128/f73f2200-5d53-11ea-8264-ddd345f11ee4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240113%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240113T094947Z&X-Amz-Expires=300&X-Amz-Signature=9a68281430758e7086ced6111251651828327ca6e6d68424cb6ddb6037dfd7e8&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=65527128&response-content-disposition=attachment%3B%20filename%3DwinCodeSign-2.6.0.7z&response-content-type=application%2Foctet-stream": remote error: tls: error decoding message
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/download.DownloadArtifact
        /Volumes/data/Documents/app-builder/pkg/download/artifactDownloader.go:107
github.com/develar/app-builder/pkg/download.downloadFromGithub
        /Volumes/data/Documents/app-builder/pkg/download/tool.go:63
github.com/develar/app-builder/pkg/download.DownloadWinCodeSign
        /Volumes/data/Documents/app-builder/pkg/download/tool.go:58
github.com/develar/app-builder/pkg/rcedit.editResources
        /Volumes/data/Documents/app-builder/pkg/rcedit/rcedit.go:30
github.com/develar/app-builder/pkg/rcedit.ConfigureCommand.func1
        /Volumes/data/Documents/app-builder/pkg/rcedit/rcedit.go:25
github.com/alecthomas/kingpin.(*actionMixin).applyActions
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/actions.go:28
github.com/alecthomas/kingpin.(*Application).applyActions
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:557
github.com/alecthomas/kingpin.(*Application).execute
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:390
github.com/alecthomas/kingpin.(*Application).Parse
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:222
main.main
        /Volumes/data/Documents/app-builder/main.go:90
runtime.main
        /usr/local/Cellar/go/1.17/libexec/src/runtime/proc.go:255
runtime.goexit
        /usr/local/Cellar/go/1.17/libexec/src/runtime/asm_amd64.s:1581
  • Above command failed, retrying 3 more times
  ⨯ Get "https://objects.githubusercontent.com/github-production-release-asset-2e65be/65527128/f73f2200-5d53-11ea-8264-ddd345f11ee4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240113%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240113T094949Z&X-Amz-Expires=300&X-Amz-Signature=accbb12c4b1f2b87b4085151c075438e324ada0991d368a368511b39d0a68e3d&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=65527128&response-content-disposition=attachment%3B%20filename%3DwinCodeSign-2.6.0.7z&response-content-type=application%2Foctet-stream": remote error: tls: error decoding message
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/download.DownloadArtifact
        /Volumes/data/Documents/app-builder/pkg/download/artifactDownloader.go:107
github.com/develar/app-builder/pkg/download.downloadFromGithub
        /Volumes/data/Documents/app-builder/pkg/download/tool.go:63
github.com/develar/app-builder/pkg/download.DownloadWinCodeSign
        /Volumes/data/Documents/app-builder/pkg/download/tool.go:58
github.com/develar/app-builder/pkg/rcedit.editResources
        /Volumes/data/Documents/app-builder/pkg/rcedit/rcedit.go:30
github.com/develar/app-builder/pkg/rcedit.ConfigureCommand.func1
        /Volumes/data/Documents/app-builder/pkg/rcedit/rcedit.go:25
github.com/alecthomas/kingpin.(*actionMixin).applyActions
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/actions.go:28
github.com/alecthomas/kingpin.(*Application).applyActions
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:557
github.com/alecthomas/kingpin.(*Application).execute
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:390
github.com/alecthomas/kingpin.(*Application).Parse
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:222
main.main
        /Volumes/data/Documents/app-builder/main.go:90
runtime.main
        /usr/local/Cellar/go/1.17/libexec/src/runtime/proc.go:255
runtime.goexit
        /usr/local/Cellar/go/1.17/libexec/src/runtime/asm_amd64.s:1581
  • Above command failed, retrying 2 more times
  ⨯ Get "https://objects.githubusercontent.com/github-production-release-asset-2e65be/65527128/f73f2200-5d53-11ea-8264-ddd345f11ee4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240113%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240113T094949Z&X-Amz-Expires=300&X-Amz-Signature=accbb12c4b1f2b87b4085151c075438e324ada0991d368a368511b39d0a68e3d&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=65527128&response-content-disposition=attachment%3B%20filename%3DwinCodeSign-2.6.0.7z&response-content-type=application%2Foctet-stream": remote error: tls: error decoding message
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/download.DownloadArtifact
        /Volumes/data/Documents/app-builder/pkg/download/artifactDownloader.go:107
github.com/develar/app-builder/pkg/download.downloadFromGithub
        /Volumes/data/Documents/app-builder/pkg/download/tool.go:63
github.com/develar/app-builder/pkg/download.DownloadWinCodeSign
        /Volumes/data/Documents/app-builder/pkg/download/tool.go:58
github.com/develar/app-builder/pkg/rcedit.editResources
        /Volumes/data/Documents/app-builder/pkg/rcedit/rcedit.go:30
github.com/develar/app-builder/pkg/rcedit.ConfigureCommand.func1
        /Volumes/data/Documents/app-builder/pkg/rcedit/rcedit.go:25
github.com/alecthomas/kingpin.(*actionMixin).applyActions
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/actions.go:28
github.com/alecthomas/kingpin.(*Application).applyActions
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:557
github.com/alecthomas/kingpin.(*Application).execute
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:390
github.com/alecthomas/kingpin.(*Application).Parse
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:222
main.main
        /Volumes/data/Documents/app-builder/main.go:90
runtime.main
        /usr/local/Cellar/go/1.17/libexec/src/runtime/proc.go:255
runtime.goexit
        /usr/local/Cellar/go/1.17/libexec/src/runtime/asm_amd64.s:1581

解决方案

  • 根据报错提示中的下载地址https://objects.githubusercontent.com/github-production-release-asset-2e65be/65527128/f73f2200-5d53-11ea-8264-ddd345f11ee4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240113%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240113T094947Z&X-Amz-Expires=300&X-Amz-Signature=9a68281430758e7086ced6111251651828327ca6e6d68424cb6ddb6037dfd7e8&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=65527128&response-content-disposition=attachment%3B%20filename%3DwinCodeSign-2.6.0.7z&response-content-type=application%2Foctet-stream,下载文件到本地,将文件解压放到目录C:\Users\lenovo\AppData\Local\electron-builder\Cache\winCodeSign

image.png

问题2:下载依赖包nsis-3.0.4.1nsis-resources-3.4.1失败

 F:\EH\xxx\xxx\app> npm run dist-win32

> xxx@2.0.2 dist-win32
> electron-builder --win --ia32

  • electron-builder  version=23.6.0 os=10.0.25997
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=build\builder-effective-config.yaml
  • packaging       platform=win32 arch=ia32 electron=25.1.1 appOutDir=build\win-ia32-unpacked
  • asar usage is disabled — this is strongly not recommended  solution=enable asar and use asarUnpack to unpack files that must be externally available
  • asar usage is disabled — this is strongly not recommended  solution=enable asar and use asarUnpack to unpack files that must be externally available
  • building        target=nsis file=build\xxx-win32-ia32-2.0.2.exe archs=ia32 oneClick=false perMachine=true
  ⨯ Get "https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.4.1/nsis-3.0.4.1.7z": EOF
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/download.DownloadArtifact
        /Volumes/data/Documents/app-builder/pkg/download/artifactDownloader.go:107
github.com/develar/app-builder/pkg/download.ConfigureArtifactCommand.func1
        /Volumes/data/Documents/app-builder/pkg/download/artifactDownloader.go:27
github.com/alecthomas/kingpin.(*actionMixin).applyActions
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/actions.go:28
github.com/alecthomas/kingpin.(*Application).applyActions
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:557
github.com/alecthomas/kingpin.(*Application).execute
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:390
github.com/alecthomas/kingpin.(*Application).Parse
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:222
main.main
        /Volumes/data/Documents/app-builder/main.go:90
runtime.main
        /usr/local/Cellar/go/1.17/libexec/src/runtime/proc.go:255
runtime.goexit
        /usr/local/Cellar/go/1.17/libexec/src/runtime/asm_amd64.s:1581
  ⨯ F:\EH\xxx\xxx\app\node_modules\app-builder-bin\win\x64\app-builder.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:

解决方案

  • 点击报错中的链接https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.4.1/nsis-3.0.4.1.7z,下载文件到本地
  • 解压下载的文件,将解压后的文件放到目录C:\Users\lenovo\AppData\Local\electron-builder\Cache\winCodeSign

image.png