I am building an app with Electron 14, and node v14.17.7, respectively [npm 6.14.15] to build my native node modules.
Every time I execute npm install
all my native dependencies are rebuilt from source (since the combination of Electron and node version is not available as a prebuilt in the repo).
Here is an exert from the logs:
• electron-builder version=22.14.13
• loaded configuration file=package.json ("build" field)
• rebuilding native dependencies [email protected] platform=darwin arch=x64
• install prebuilt binary name=foo version=9.2.4 platform=darwin arch=x64 napi=
• build native dependency from sources name=foo
version=9.2.4
platform=darwin
arch=x64
napi=
reason=prebuild-install failed with error
(run with env DEBUG=electron-builder to get more information)
prebuild-install WARN install prebuilt binaries enforced with --force!
prebuild-install WARN install prebuilt binaries may be out of date!
The following message stands out:
WARN install prebuilt binaries enforced with --force!
The line is printed here
if (opts.force) {
log.warn('install', 'prebuilt binaries enforced with --force!')
log.warn('install', 'prebuilt binaries may be out of date!')
Unfortunately, I have no idea or clue where force
is set to true. Can anyone help?
The build
field of the package.json is this:
"build": {
"appId": "com.foo.foo",
"productName": "foo",
"buildVersion": "1.0.0",
"publish": {
"provider": "s3",
"bucket": "foo",
"region": "foo",
"endpoint": "https://foo.s3.amazonaws.com"
},
"afterPack": "./scripts/afterPack.js",
"afterSign": "./scripts/notarization.js",
"afterAllArtifactBuild": "./scripts/notarization_dmg.js",
"files": [
"dist/**/*",
"main.js",
],
"extraResources": [
"./extra/**"
],
"dmg": {
"sign": true
},
"mac": {
"binaries": [
"./python34/bin/python3.4",
],
"target": [
"zip",
"dmg"
],
"hardenedRuntime": true,
"entitlements": "./scripts/entitlements.mac.plist",
"icon": "./public/icons/mac/icon.icns"
},
"directories": {
"output": "foo-release",
"buildResources": "public"
}
Set
DEBUG=electron-builder
before running npm install to get more info.Also consider this note from prebuild-install
Edit: Try
"npmRebuild": "false",
in the build field (via)opts.force = false
at node_modules/prebuild-install/bin.js:45npm install --verbose
for even more output andnpm install --timing
to save the debug logs for examination afterwards if the former gives too much.--inspect-brk
at the end between$NODE
and$NPM_CLI_JS
. Then use a Chromium browser's devtools/your IDE to step through the install process with hotkeys F10 and F11 in browsers. You can set breakpoints in advance or insert them viadebugger;
and the run 'till there to speedup this process with hotkey F8.