Skip to content

fix: upgrade Electron for Node 24.16+/26 install compatibility#1352

Merged
Astro-Han merged 7 commits into
devfrom
pawwork/yauzl-override-node-compat
Jun 17, 2026
Merged

fix: upgrade Electron for Node 24.16+/26 install compatibility#1352
Astro-Han merged 7 commits into
devfrom
pawwork/yauzl-override-node-compat

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary

Fix Electron's silent installation failure on Node 24.16.0+ and 26.x by upgrading Electron from 40.8.0 to 40.10.3, which includes the upstream fix (electron/electron#51886) that replaces extract-zip with @electron-internal/extract-zip. Remove the now-unnecessary Node version guard.

Why

PR #1346 added a check-node.mjs guard that blocked bun install on Node ≥25. That guard was a workaround: the real issue is extract-zipyauzl@2.xfd-slicer@1.x, which has a broken stream lifecycle on newer Node versions, causing Electron's postinstall to silently skip binary extraction.

Electron 40.10.3 includes the official fix (electron/electron#51886) that replaces extract-zip entirely. This is cleaner than a transitive dependency override.

Related Issue

Human Review Status

Pending

Review Focus

Check that Electron 40.10.3 upgrade doesn't introduce regressions, and that the CI install matrix covers both Node 24 and 26.

Risk Notes

  • Electron 40.8.0 → 40.10.3 is a patch-level upgrade within the same major.minor line. The upstream changelog shows only install-related fixes and the @electron/get v5 upgrade.
  • The repair-electron-install.mjs --assert-complete flag is a new exported function that reuses existing internal checks. It does not change the repair flow.
  • No visible UI changed; no platform/packaging surface changed; no docs or release notes needed.

Migration for existing worktrees

If you have an existing worktree or local checkout with a broken Electron dist (244K stub, missing path.txt or Frameworks):

# Option 1: clean reinstall
rm -rf node_modules && bun install --frozen-lockfile

# Option 2: repair without full reinstall
node packages/desktop-electron/scripts/repair-electron-install.mjs

How To Verify

bun install --frozen-lockfile: passes (lockfile is in sync)
git diff --check: clean
node ./scripts/repair-electron-install.mjs --assert-complete: passes

Node 26 fresh install verification (completed locally):
  Node: v26.3.0
  Electron: 40.10.3
  Steps: trash node_modules && bun install --frozen-lockfile
  path.txt: exists, contains "Electron.app/Contents/MacOS/Electron"
  Electron.app/Contents/Frameworks/: exists (Electron Framework.framework + Helpers)
  dist size: 275M

CI coverage:
  - desktop-smoke: pre-repair assertion via --assert-complete
  - install-matrix: Node 24 + 26 fresh install + assertion

Screenshots or Recordings

Not applicable — CLI/install output only.

Checklist

  • Type label — this PR carries exactly one of bug, enhancement, task, documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.
  • Routing labels — this PR carries at least one of app, ui, platform, harness, ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.
  • Priority label — this PR carries exactly one of P0, P1, P2, P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.
  • Human Review Status above is set to Pending, Approved by @<reviewer>, or Not required: <reason> (default is Pending; "not required" is restricted to bot-authored low-risk PRs).
  • I linked the related issue, or stated in Summary why there is no issue.
  • I described the review focus and any meaningful risks.
  • I replaced the example block in How To Verify with the real verification steps and the key result for each.
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope.
  • (conditional) I manually checked visible UI or copy changes when needed, with screenshots or recordings. Leave unticked only if no visible UI or copy changed.
  • (conditional) I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes. Leave unticked only if no platform/packaging surface was touched.
  • (conditional) I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant. Leave unticked only if none of those surfaces was touched.
  • I reviewed the final diff for unrelated changes and suspicious dependency changes.
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English.

…atibility

The previous preinstall guard blocked all Node >= 25 because Electron 40.8.0's
extract-zip dependency (yauzl@2.x) silently fails on Node >= 24.16.0 due to a
broken stream lifecycle in fd-slicer@1.x.

Instead of forcing developers to manage Node versions, override yauzl to ^3.3.1
which bundles its own fixed fd-slicer. This is the same workaround used by
serenity-js, shipshapecode/swach, and recommended in electron/electron#51619.

The Node 25+ guard in check-node.mjs and its tests are removed. The format
validation check is kept as a safety net.

Related: electron/electron#51619, electron/electron#51886
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Removes the Node version guard script (script/check-node.mjs), its test file, and the associated preinstall/test:install-guard npm scripts, along with the corresponding CI step in the typecheck job. Adds a pre-repair Electron install verification step to the desktop smoke workflow and pins yauzl to 3.3.1 in overrides.

Changes

CI Tooling Changes

Layer / File(s) Summary
Remove Node version guard and CI step
package.json, .github/workflows/ci.yml, script/check-node.mjs, script/check-node.test.mjs
preinstall and test:install-guard scripts removed from package.json; the install guard unit CI step dropped from the typecheck job; check-node.mjs and its test file deleted entirely.
Electron pre-repair assertion and yauzl override
.github/workflows/desktop-smoke.yml, package.json
New step added before the repair phase in the desktop smoke workflow: imports isElectronInstallComplete, validates path.txt content, and emits a workflow error with exit code 1 on any missing or incorrect condition. yauzl pinned to 3.3.1 in package.json overrides.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

desktop, dependencies

Poem

🐇 Hop hop, the Node guard is gone today,
No more checking versions along the way!
But Electron must pass the pre-repair test,
path.txt checked — only the best!
The rabbit tidies CI with a cheerful bounce. 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description is comprehensive and well-structured, following the required template with all major sections completed.
Title check ✅ Passed The title 'fix: upgrade Electron for Node 24.16+/26 install compatibility' directly addresses the main change: replacing a Node version guard with a yauzl dependency override to fix Electron installation on Node 24.16+ and 26.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pawwork/yauzl-override-node-compat

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Astro-Han Astro-Han added bug Something isn't working platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions P1 High priority labels Jun 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the yauzl dependency to package.json and removes the restriction preventing Node versions 25 and above from installing dependencies in script/check-node.mjs, updating the corresponding tests to allow Node 26. The reviewer suggests pinning the yauzl dependency to an exact version (3.3.1) instead of using a caret range to maintain consistency with other pinned dependencies and ensure reproducible builds.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread package.json Outdated
@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@github-actions github-actions Bot added ci Continuous integration / GitHub Actions and removed platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions labels Jun 17, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested priority: P2 (includes non-doc, non-test paths outside the low-risk bucket).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

- Delete script/check-node.mjs and script/check-node.test.mjs (P3)
- Remove preinstall hook and test:install-guard script from package.json
- Remove install guard unit step from CI workflow
- Update bun.lock after adding yauzl override (P1)

The yauzl@3.3.1 override fixes Electron's silent installation failure
on Node >= 24.16.0. The Node version guard is no longer needed.
Add a pre-repair assertion in desktop-smoke that checks path.txt and
Electron Framework.framework exist after bun install. This ensures the
yauzl override is working — if it fails, CI will catch it before the
repair step can mask the problem.
…ctronInstallComplete

Replace the shell-based directory checks with a call to the repair script's
exported isElectronInstallComplete function, which verifies:
- The platform-specific Electron binary exists (dist/Electron.app/Contents/MacOS/Electron)
- The Framework binary file exists (not just the directory)

This prevents partially-damaged dist directories from passing the assertion
and being silently masked by the repair step.
Add a check that path.txt exists and contains the expected macOS platform
path 'Electron.app/Contents/MacOS/Electron'. This catches the #1329 failure
mode where the binary and Framework were present but path.txt was missing.
…l matrix

- Upgrade electron 40.8.0 → 40.10.3 (includes upstream extract-zip fix)
- Remove yauzl override (no longer needed with Electron 40.10.3)
- Add --assert-complete flag to repair-electron-install.mjs that checks
  binary, Framework, and path.txt content
- Replace inline CI assertion with single-line --assert-complete call
- Add install-matrix CI job covering Node 24 and 26
- Update PR description with migration guidance

Related: electron/electron#51886, #1329
@github-actions github-actions Bot added the platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions label Jun 17, 2026
@Astro-Han Astro-Han changed the title fix: replace Node version guard with yauzl override fix: upgrade Electron for Node 24.16+/26 install compatibility Jun 17, 2026
@Astro-Han Astro-Han merged commit 4abeb05 into dev Jun 17, 2026
37 of 39 checks passed
@Astro-Han Astro-Han deleted the pawwork/yauzl-override-node-compat branch June 17, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci Continuous integration / GitHub Actions P1 High priority platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant