解决 npm build electron 超时的问题
出现此问题的原因是,GitHub 源被墙了,导致无法下载相关资源。
问题提示:
• downloaded url=https://github.com/electron-userland/electron-builder-binaries/releases/download/snap-template-4.0-2/snap-template-electron-4.0-2-amd64.tar.7z duration=7.99s
⨯ Get "https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-12.0.1/appimage-12.0.1.7z": EOF
github.com/develar/app-builder/pkg/download.(*Downloader).follow.func1
/Volumes/data/Documents/app-builder/pkg/download/downloader.go:206
解决方法:
设置一下 ELECTRON_BUILDER_BINARIES_MIRROR
环境变量。此变量可在 ~/.npmrc
或 ~/.yarnrc
设置
export ELECTRON_BUILDER_BINARIES_MIRROR=https://mirrors.huaweicloud.com/electron-builder-binaries/