nextron
nextron copied to clipboard
Error when trying to build for Windows
Since I update to the version 6.0.1
, I'm having errors building for Windows on macOS and Linux (CI Runner with Docker: electronuserland/builder:wine
)
Build for Linux and macOS work just fine. It only fails on when trying to build for Windows with electron-builder --win --x64
,electron-builder --win --ia32
or and electron-builder --win
My electron-builder.yml
looks like this:
appId: my.app.com
productName: MyApp
copyright: Copyright © 2020 MyApp
directories:
output: dist
buildResources: resources
files:
- from: .
filter:
- package.json
- app
publish: null
And the output is this:
Export successful
[nextron] Building main process
[nextron] Packaging - please wait a moment
• electron-builder version=22.9.1 os=20.1.0
• loaded configuration file=/Users/dev-user/electron-project/electron-builder.yml
• writing effective config file=dist/builder-effective-config.yaml
• rebuilding native dependencies [email protected], [email protected] platform=win32 arch=x64
• install prebuilt binary name=sharp version=0.26.2 platform=win32 arch=x64
⨯ cannot build native dependency reason=prebuild-install failed with error and build from sources not possible because platform or arch not compatible
cause=exit status 1
errorOut=prebuild-install info begin Prebuild-install version 5.3.6
prebuild-install WARN install prebuilt binaries enforced with --force!
prebuild-install WARN install prebuilt binaries may be out of date!
prebuild-install info looking for cached prebuild @ /Users/dev-user/.npm/_prebuilds/f212f2-sharp-v0.26.2-electron-v85-win32-x64.tar.gz
prebuild-install http request GET https://github.com/lovell/sharp/releases/download/v0.26.2/sharp-v0.26.2-electron-v85-win32-x64.tar.gz
prebuild-install http 404 https://github.com/lovell/sharp/releases/download/v0.26.2/sharp-v0.26.2-electron-v85-win32-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=11.0.3 runtime=electron arch=x64 libc= platform=win32)
command=/Users/dev-user/.nvm/versions/node/v12.18.4/bin/node /Users/dev-user/electron-project/node_modules/prebuild-install/bin.js --platform=win32 --arch=x64 --target=11.0.3 --runtime=electron --verbose --force
workingDir=/Users/dev-user/electron-project/node_modules/sharp
Cannot build electron packages:
Error: Command failed with exit code 1: electron-builder --win --x64
Anyone an idea how I can fix this or how I can turn on more verbose logging? Thanks.
@lailo
I think it is because of sharp
.
# success
$ npx electron-rebuild --force --arch x64 --which-module sharp
# failed
$ electron-builder install-app-deps --platform win32 --arch x64
I'm investigating now :)
@lailo
Could you downgrade nextron?
I think this is not a part of nextron.
It may be the platform problem, that is, it is necessary for the native binary for Windows to be built on the same platform.
Thanks for replying @saltyshiomix.
When I use "nextron": "^5.15.6"
with "electron": "^10.1.5"
, the --win build step works just fine.
But as soon as I update to"nextron": "^6.0.1"
with "electron": "^10.1.5"
or "electron": "^11.0.3"
it always fails.
Here is the output of the build done with "nextron": "^5.15.6"
and "electron": "^10.1.5"
on macOS:
Export successful
[nextron] Building main process
[nextron] Packaging - please wait a moment
• electron-builder version=22.9.1 os=20.1.0
• loaded configuration file=/Users/dev/my-app/electron-builder.yml
• writing effective config file=dist/builder-effective-config.yaml
• rebuilding native dependencies [email protected] platform=win32 arch=x64
• packaging platform=win32 arch=x64 electron=10.1.6 appOutDir=dist/win-unpacked
• rebuilding native dependencies [email protected] platform=win32 arch=ia32
• packaging platform=win32 arch=ia32 electron=10.1.6 appOutDir=dist/win-ia32-unpacked
• building target=nsis file=dist/my-app-0.1.0-win.exe archs=x64, ia32 oneClick=true perMachine=false
• building block map blockMapFile=dist/my-app-0.1.0-win.exe.blockmap
[nextron] See `dist` directory
You're welcome, @lailo .
But I tested "nextron": "^5.15.6"
it always fails as you mentioned.
Could you downgrade "nextron": "^5.15.6"
again and try building the app?
@lailo
I found the solution here.
Please add the config below in package.json
:
{
"build": {
"buildDependenciesFromSource": true
}
}
I figured out that the Electron auto-updater packages required for Windows (electron-squirrel-startup
and electron-builder-squirrel-windows
) had some part in producing this error.
By removing the Electron auto-updater completely, and adding the buildDependenciesFromSource : true
option to my electron-builder.yml
file, the build for windows worked just fine.
I'll investigate the auto-updater issue and if I figure out something, I'll share my findings here with you.
Please feel free to reopen the issue if any updates or troubles :)