Rebuilding native dependencies states one platform/arch, builds another
See original GitHub issue- Version:
22.4.1
(initially found bug) and22.7.0
(bug still present on latest) - Electron Version:
7.3.0
(initially found bug) and8.3.0
(upgraded to latest 8.x, v9.0.0 a few days old) - Electron Type (current, beta, nightly): NA
- Target: Win:nsis
- Node/NPM: Node=v12.16.1 NPM=6.13.4
Summary:
During build process on container (Linux) for Windows target says it is rebuilding native dependencies for win32-x64
, but upon running the application (after a error-less build) an error occurs saying linux-x64
binaries cannot be used on the win32-x64
platform.
Details:
I’ve run the following on electronuserland/builder:wine
and electronuserland/builder:wine-mono
images:
npm ci
npm run bundle:electron-renderer # Webpack bundle for renderer process
npm run transpile # Babel to transpile code used by main process
node ./scripts/pre-package.js && electron-builder build --win --publish never
With the following under build
in package.json
:
{
"asar": true,
"appId": "com.maestro.app",
"productName": "Maestro",
"directories": {
"output": "electron-release"
},
"files": [
"build/",
"index.js",
"bundle/renderer-entry.js",
"node_modules/",
"package.json"
],
"extraFiles": [
"build/icon.png",
"build/icon.ico"
],
"detectUpdateChannel": false,
"publish": {
"provider": "generic",
"url": "https://example.com/maestro"
},
"win": {
"target": "nsis",
"verifyUpdateCodeSignature": false,
"icon": "build/icon.ico"
},
"nsis": {
"oneClick": false,
"perMachine": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true
}
}
The Windows installer builds without errors. However, after running the installer, I get the following error upon starting the application:
So there is an issue with getting the right binary for the “sharp” package. During the build process, it states that it is “rebuilding native dependencies” using win32
and x64
, as shown below:
> node ./scripts/pre-package.js && electron-builder build --win --publish never
• electron-builder version=22.4.1 os=3.10.0-1127.8.2.el7.x86_64
• loaded configuration file=package.json ("build" field)
• electron-rebuild not required if you use electron-builder, please consider to remove excess dependency from devDependencies
To ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`
• rebuilding native dependencies dependencies=sharp@0.25.3, fsevents@1.2.11 platform=win32 arch=x64
• install prebuilt binary name=sharp version=0.25.3 platform=win32 arch=x64
• packaging platform=win32 arch=x64 electron=7.3.0 appOutDir=electron-release/win-unpacked
I’ve also made the following two changes and gotten the same error message:
- Add this after
npm ci
:./node_modules/.bin/electron-builder install-app-deps --platform win32 --arch x64
- Add
"npmRebuild": false
topackage.json
underbuild
.
This appears to just remove the rebuild step from the electron-builder build
step and instead makes it an earlier step. The output for this is:
$ ./node_modules/.bin/electron-builder install-app-deps --platform win32 --arch x64
• electron-builder version=22.7.0
• loaded configuration file=package.json ("build" field)
• rebuilding native dependencies dependencies=sharp@0.25.3, fsevents@1.2.11 platform=win32 arch=x64
• install prebuilt binary name=sharp version=0.25.3 platform=win32 arch=x64
This has been performed on:
electron-builder@22.4.1
withelectron@7.3.0
onelectronuserland/builder:wine
electron-builder@22.7.0
withelectron@7.3.0
onelectronuserland/builder:wine
electron-builder@22.7.0
withelectron@8.3.0
onelectronuserland/builder:wine
electron-builder@22.7.0
withelectron@8.3.0
onelectronuserland/builder:wine-mono
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:14 (1 by maintainers)
Top GitHub Comments
We’re having a similar issue. I believe this issue needs to be reopened.
Please reopen.