Skip to content

build: pin electron exactly, so packaging works without a second declaration - #605

Merged
EtienneLescot merged 1 commit into
mainfrom
fix/electron-version-pin
Sep 4, 2026
Merged

build: pin electron exactly, so packaging works without a second declaration#605
EtienneLescot merged 1 commit into
mainfrom
fix/electron-version-pin

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

The bug

npm run build:win fails at electron-builder in any checkout without its own node_modules/electron — a git worktree, typically, where Node's resolution walks up and finds the parent's copy but electron-builder looks only at the project's:

⨯ Electron version "^41.2.1" is a range, not a fixed version.
⨯ Cannot compute electron version from installed node modules

Every prior step succeeds — native helpers, ffmpeg, onnxruntime, the compositor addon, tsc, vite build. Only packaging fails.

Why pin rather than set electronVersion

Setting it in electron-builder.json5 would make the version two facts that have to agree, and nothing would notice when they stopped. The dependency declaration is the one place the version is written; electron-builder reads it there when it isn't a range.

The caret was already inert where it mattered:

  • The lockfile pins 41.2.1, and every CI job installs through .github/actions/setup, which runs npm ci.
  • Nothing else declares a range on electron — one occurrence in the whole lockfile, the root.

It only ever applied to a bare npm install, and an unattended Electron bump is what we want least here: the packaging config holds facts against one release by hand (minimumSystemVersion against Electron 41's own LSMinimumSystemVersion), and AGENTS.md records behaviour observed on 41.2.1 exactly. build-and-packaging.md:269 already claimed the version was exact in package.json — now it is.

A comment in electron-builder.json5 says why there is no electronVersion there and names the error, so the next person to hit it reaches for npm ci rather than the second source of truth.

One unrelated line in the lockfile

Regenerating it also dropped @mediapipe/selfie_segmentation. That left package.json in 6e5ffa9, when segmentation moved into the compositor, and was never regenerated out of the lock. Nothing imports it; npm ci was downloading it in every job. Kept rather than hand-reverted — putting known-dead weight back to keep a diff tidy is the wrong trade.

Verification

npm run build:win, unmodified, in a worktree with no node_modules/electron and no override flag. Exit 0, installer produced.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Clarified how the Electron version is determined during application packaging.
    • Added guidance to install dependencies when the local Electron package is unavailable.
  • Chores

    • Pinned the Electron development dependency to version 41.2.1 for consistent builds.

…aration

`npm run build:win` failed at electron-builder in any checkout without its own
`node_modules/electron` — a git worktree, typically, where Node's resolution
walks up and finds the parent's copy but electron-builder looks only at the
project's:

    Electron version "^41.2.1" is a range, not a fixed version.

electron-builder needs an exact version because it downloads the binaries for
one release. Given the range and no local install, it refuses.

Pinned rather than answered with `electronVersion` in electron-builder.json5,
because that would make the version two facts that have to agree and nothing
would notice when they stopped. The dependency declaration is the one place
the version is written; electron-builder reads it there.

The caret was already inert where it mattered: the lockfile pins 41.2.1 and
every CI job installs through .github/actions/setup, which runs `npm ci`. It
only ever applied to a bare `npm install` — and an unattended Electron bump is
what we want least here, since the packaging config carries facts held against
one release by hand (`minimumSystemVersion` against Electron 41's own
`LSMinimumSystemVersion`) and AGENTS.md records behaviour observed on 41.2.1
exactly. build-and-packaging.md already claimed the version was exact; now it
is.

A comment in electron-builder.json5 says why there is no `electronVersion`
there and names the error, so the next person to hit it adds `npm ci` rather
than the second source of truth.

Regenerating the lockfile also dropped `@mediapipe/selfie_segmentation`, which
left package.json in 6e5ffa9 when segmentation moved into the compositor and
was never regenerated out of the lock. Nothing imports it; `npm ci` was
downloading it in every job.

Verified: `npm run build:win`, unmodified, in a worktree with no
`node_modules/electron` and no override flag — installer produced.
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 69aa771a-e7ae-4900-a6a0-f2601ae5fa2d

📥 Commits

Reviewing files that changed from the base of the PR and between 8d9411e and c28d220.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • electron-builder.json5
  • package.json

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The Electron development dependency is pinned to version 41.2.1. electron-builder.json5 documents that electronVersion is intentionally omitted and that worktrees without a local Electron installation should run npm ci.

Changes

Electron version resolution

Layer / File(s) Summary
Pin and document Electron version
package.json, electron-builder.json5
The electron devDependency now uses the exact version 41.2.1. Configuration comments document the version source and the npm ci remedy for missing local dependencies.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to c28d2

Electron packaging now consistently resolves version 41.2.1, with documentation explaining the worktree installation requirement. The manifest and lockfile are aligned, so the change is ready to merge.

Suggested reviewers: sepion02

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides detailed context, rationale, impact, and verification results. It does not follow the required template and omits the required Summary, Related issue, Type of change, Release … Restructure the description using the repository template. Add the required headings and complete the relevant checkboxes, issue reference, testing details, release impact, and desktop or installer impact. State that screenshots are not app…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: pinning Electron exactly to fix packaging in checkouts without a local Electron installation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Full details: Description check

Explanation

The description provides detailed context, rationale, impact, and verification results. It does not follow the required template and omits the required Summary, Related issue, Type of change, Release impact, Desktop impact, Screenshots / video, and Testing sections.

Resolution

Restructure the description using the repository template. Add the required headings and complete the relevant checkboxes, issue reference, testing details, release impact, and desktop or installer impact. State that screenshots are not applicable if no visual changes exist.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/electron-version-pin

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.

@EtienneLescot
EtienneLescot merged commit 94601b1 into main Sep 4, 2026
18 of 20 checks passed
@EtienneLescot
EtienneLescot deleted the fix/electron-version-pin branch September 4, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant