Repository navigation
fix: support Node v24+ with native-keymap C++20 patch and automated postinstall - #4211
Merged
Merged
Conversation
… postinstall Node v24+ requires C++20 in V8 headers, but [email protected]'s binding.gyp doesn't declare it, causing ~20 compiler errors. Also, Electron v42+ no longer ships an install script, so the binary must be downloaded explicitly. - Add patches/native-keymap+3.3.9.patch: adds C++20 flags for macOS, Linux, Windows - Add postinstall script to package.json that runs automatically after npm install: 1. Downloads Electron binary (node_modules/electron/install.js) 2. Applies the C++20 patch via patch-package 3. Rebuilds native modules for Electron's ABI via @electron/rebuild 4. Generates minified translation files via minify-locales - Add patch-package to devDependencies - Bump electron to ^42.1.0 - Add SETUP.md documenting the setup process and mirror configuration Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to make the development install experience work on newer Node/Electron versions by automatically downloading Electron, applying a native-keymap C++20 build patch, rebuilding native modules, and generating minified locale files during npm install.
Changes:
- Added a
postinstallhook to run Electron download, applypatch-package, rebuild native modules, and minify locales automatically. - Introduced a
patch-packagepatch to force C++20 for[email protected]across macOS/Linux/Windows. - Added a new
SETUP.mdwith quickstart, mirror configuration, and troubleshooting guidance.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
SETUP.md |
New developer setup guide describing the new automated postinstall flow and troubleshooting. |
patches/native-keymap+3.3.9.patch |
Patch-package diff to add C++20 compilation settings to native-keymap’s binding.gyp. |
package.json |
Adds postinstall, adds patch-package, and bumps Electron to ^42.1.0. |
package-lock.json |
Lockfile updates for Electron bump and new patch-package dependency tree. |
Comments suppressed due to low confidence (1)
package.json:37
- The
postinstallscript inlines multiple steps, including a rebuild command that’s already defined asrebuild-native. Consider delegating to existing npm scripts (e.g.npm run rebuild-nativeandnpm run minify-locales) to avoid duplication and keep flags/behavior consistent if these steps need to change later.
"scripts": {
"postinstall": "node node_modules/electron/install.js && patch-package && npx @electron/rebuild -f && npm run minify-locales",
"format": "prettier --write .",
"lint": "eslint --cache .",
"minify-locales": "node scripts/minify-locales.mjs",
"rebuild-native": "npx @electron/rebuild -f",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closed
thimbleberrysystems
pushed a commit
to thimbleberrysystems/WordBird
that referenced
this pull request
Jun 21, 2026
…ostinstall (marktext#4211) * fix: support Node v24+ by patching native-keymap C++20 and automating postinstall Node v24+ requires C++20 in V8 headers, but [email protected]'s binding.gyp doesn't declare it, causing ~20 compiler errors. Also, Electron v42+ no longer ships an install script, so the binary must be downloaded explicitly. - Add patches/native-keymap+3.3.9.patch: adds C++20 flags for macOS, Linux, Windows - Add postinstall script to package.json that runs automatically after npm install: 1. Downloads Electron binary (node_modules/electron/install.js) 2. Applies the C++20 patch via patch-package 3. Rebuilds native modules for Electron's ABI via @electron/rebuild 4. Generates minified translation files via minify-locales - Add patch-package to devDependencies - Bump electron to ^42.1.0 - Add SETUP.md documenting the setup process and mirror configuration Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * chore: remove SETUP.md Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[email protected]'sbinding.gypdoesn't declare it, causing ~20 compiler errors. Additionally, Electron v42+ no longer ships an install script, so the binary isn't downloaded duringnpm install.postinstallhook handles everything —npm install && npm run devnow works out of the box on any supported Node version.Changes
patches/native-keymap+3.3.9.patchCLANG_CXX_LANGUAGE_STANDARD), Linux (cflags_cc), and Windows (LanguageStandard)package.jsonpostinstallscript; addspatch-packageto devDependencies; bumpselectronto^42.1.0SETUP.mdpostinstall flow
Test plan
npm install && npm run dev— app opens without errorspatches/native-keymap+3.3.9.patchapplies cleanly viapatch-package🤖 Generated with Claude Code