Guide for performing Node.js version upgrades in the Electron project. Use when working on the roller/node/main branch to fix patch conflicts during `e sync --3`. Covers the patch application workflow, conflict resolution, analyzing upstream Node.js changes, and proper commit formatting for patch fixes.
Run e sync --3 repeatedly, fixing patch conflicts as they arise, until it succeeds. Then export patches and commit changes atomically.
Phase One is complete when:
e sync --3 exits with code 0 (no patch failures)Do not stop until these criteria are met.
CRITICAL Do not delete or skip patches unless 100% certain the patch is no longer needed. For major version upgrades, patches that shim deprecated V8 APIs or backport upstream changes are often deletable because the new Node.js version already incorporates them — but verify before removing. Complicated conflicts or hard to resolve issues should be presented to the user after you have exhausted all other options. Do not delete the patch just because you can't solve it.
CRITICAL Never use git am --skip and then manually recreate a patch by making a new commit. This destroys the original patch's authorship, commit message, and position in the series. If reports "No changes", investigate why — the changes were likely absorbed by a prior conflict resolution's 3-way merge. Present this situation to the user rather than skipping and recreating.
git am --continueThe roller/node/main branch is created by automation to update Electron's Node.js dependency version in DEPS. No work has been done to handle breaking changes between the old and new versions.
There are two types of Node.js version updates:
electron-roller[bot] with commit title chore: bump node to v{version}. Trivial patch index updates are handled automatically by patchup[bot]. These often land cleanly, but may require manual patch fixes.chore: upgrade Node.js to v{X}.{Y}.{Z}. These typically involve deleting obsolete patches, adapting many others, and updating @types/node in package.json.Key directories:
e commands here)../third_party/electron_node: Node.js repo (where patches apply)patches/node/: Patch files for Node.jsdocs/development/patches.md: Patch system documentationRun these once at the start of each upgrade session:
git rerere clear in both the electron and ../third_party/electron_node repos. Stale recorded resolutions from a prior attempt can silently apply wrong merges..git/hooks/pre-commit exists. If not, run yarn husky to install it. The hook runs lint-staged which handles clang-format for C++ files.e sync --3 (the --3 flag enables 3-way merge, always required)../third_party/electron_node working directorygit am --continue in ../third_party/electron_nodegit am --continue succeeds you MUST run e patches node to export fixese sync --3 succeeds, run e patches allreferences/phase-one-commit-guidelines.md NOW, then commit changes following those instructions exactly.| Command | Purpose |
|---|---|
e sync --3 | Clone deps and apply patches with 3-way merge |
git am --continue | Continue after resolving conflict (run in node repo) |
e patches node | Export commits from node repo to patch files |
e patches all | Export all patches from all targets |
e patches node --commit-updates | Export patches and auto-commit trivial changes |
e patches --list-targets | List targets and config paths |
patches/node/*.patch → [e sync --3] → ../third_party/electron_node commits
← [e patches] ←
| Situation | Action |
|---|---|
During active git am conflict | Fix in node repo, then git am --continue |
| Modifying patch outside conflict | Edit .patch file directly |
| Creating new patch (rare, avoid) | Commit in node repo, then e patches node |
Fix existing patches 99% of the time rather than creating new ones.
From: field)TODO(name) must retain original namegit am --continue says "No changes — did you forget to use 'git add'?", do NOT run git am --skip and create a replacement commit. The patch's changes were already absorbed by a prior 3-way merge resolution. This means an earlier conflict resolution pulled in too many changes. Present the situation to the user for guidance — the correct fix may require re-doing an earlier resolution more carefully to keep each patch's changes separate.Run e build -k 999 -- --quiet repeatedly, fixing build issues as they arise, until it succeeds. Then run e start --version to validate Electron launches and commit changes atomically.
Run Phase Two immediately after Phase One is complete.
Phase Two is complete when:
e build -k 999 -- --quiet exits with code 0 (no build failures)e start --version has been run to check Electron launchesDo not stop until these criteria are met. Do not delete code or features, never comment out code in order to take short cut. Make all existing code, logic and intention work.
The roller/node/main branch is created by automation to update Electron's Node.js dependency version in DEPS. No work has been done to handle breaking changes between the old and new versions. Node.js APIs (especially internal V8 integration, OpenSSL/BoringSSL compatibility, and build system files) frequently change between versions. In every case the code in Electron must be updated to account for the change in Node.js, strongly avoid making changes to the code in Node.js to fix Electron's build.
Key directories:
e commands here)../third_party/electron_node: Node.js repo (do not touch this code to fix build issues, just read it to obtain context)e build -k 999 -- --quiet (the --quiet flag suppresses per-target status lines, showing only errors and the final result)e build -t {target_that_failed}.o to build just the failed target we were specifically fixing
FAILED: 2e506007-8d5d-4f38-bdd1-b5cd77999a77 "./obj/electron/shell/browser/api/electron_api_utility_process.o" CXX obj/electron/shell/browser/api/electron_api_utility_process.o the target name is obj/electron/shell/browser/api/electron_api_utility_process.oreferences/phase-two-commit-guidelines.md NOW, then commit changes following those instructions exactly.git status in the electron repo
.patch files that only have index/hunk header changesgit commit -am "chore: update patches (trivial only)"e build succeeds, run e start --versiongit status in ../third_party/electron_node
| Command | Purpose |
|---|---|
e build -k 999 -- --quiet | Build Electron, continue on errors, suppress status lines |
e build -t {target}.o | Build just one specific target to verify a fix |
e start --version | Validate Electron launches after successful build |
When the error is in a file that Electron patches (check with grep -l "filename" patches/node/*.patch):
../third_party/electron_node/...)cd ../third_party/electron_node
git add <modified-file>
git commit --fixup=<original-patch-commit-hash>
GIT_SEQUENCE_EDITOR=: git rebase --autosquash --autostash -i <commit>^
e patches nodereferences/phase-one-commit-guidelines.md.To find the original patch commit to fixup: git log --oneline | grep -i "keyword from patch name"
The base commit for rebase is the Node.js commit before patches were applied. Find it by checking the refs/patches/upstream-head ref.
When the error is in Electron's own source code:
references/phase-one-commit-guidelines.mdreferences/phase-two-commit-guidelines.mdThese patches consistently require the most work during Node.js upgrades:
fix_handle_boringssl_and_openssl_incompatibilities.patch — Electron uses BoringSSL (via Chromium) while Node.js expects OpenSSL. This patch is large and complex, and upstream OpenSSL API changes frequently break it.fix_crypto_tests_to_run_with_bssl.patch — Companion to the above; adapts Node.js crypto tests for BoringSSL. Can grow significantly during major upgrades.support_v8_sandboxed_pointers.patch — V8 sandbox pointer support requires careful adaptation when V8 APIs change.build_add_gn_build_files.patch — The GN build file patch is large and touches many build targets. Upstream build system changes frequently conflict.Major Node.js version transitions (e.g., v22 → v24) are significantly more involved than patch bumps:
@types/node in package.json to match the new major version.This skill has additional reference files in references/:
Read these when referenced in the workflow steps.