Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: latest node-gyp with old Electron versions #6402

Merged
merged 2 commits into from
Nov 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/app-builder-lib/src/util/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,18 @@ export async function nodeGypRebuild(platform: NodeJS.Platform, arch: string, fr
log.info({ platform, arch }, "executing node-gyp rebuild")
// this script must be used only for electron
const nodeGyp = `node-gyp${process.platform === "win32" ? ".cmd" : ""}`
await spawn(nodeGyp, ["rebuild"], { env: getGypEnv(frameworkInfo, platform, arch, true) })
const args = ["rebuild"]
// headers of old Electron versions do not have a valid config.gypi file
// and --force-process-config must be passed to node-gyp >= 8.4.0 to
// correctly build modules for them.
// see also https://github.com/nodejs/node-gyp/pull/2497
const [major, minor] = frameworkInfo.version.split('.').slice(0, 2).map(n => parseInt(n, 10))
if ((major <= 13) ||
(major == 14 && minor <= 1) ||
(major == 15 && minor <= 2)) {
args.push('--force-process-config')
}
await spawn(nodeGyp, args, { env: getGypEnv(frameworkInfo, platform, arch, true) })
}

function getPackageToolPath() {
Expand Down