Skip to content

Fix Electron startup failure caused by the Host lockfile - #1125

Merged
FlorianRappl merged 1 commit into
ElectronNET:developfrom
DYH1319:fix/host-image-size-lock
Nov 5, 2026
Merged

FlorianRappl merged 1 commit into
ElectronNET:developfrom
DYH1319:fix/host-image-size-lock

Conversation

@DYH1319

@DYH1319 DYH1319 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Problem

On develop, Electron crashes at startup in the integration tests, on every runner:

Error: Cannot find module 'inherits'
Require stack:
- .../.electron/node_modules/queue/index.js
- .../.electron/node_modules/image-size/dist/index.js
- .../.electron/main.js

ElectronFixture then times out with "The Electron process did not start within 10 seconds", so every test that uses Electron fails. The develop push run for 05aa92e (run 40534971218) shows this, and so does #1124.

Cause

Two files decide what ends up in .electron/, and they disagree:

That mismatch was harmless at first: the lockfile had neither queue nor inherits, so npm resolved both fresh for image-size 1.2.1, and CI stayed green.

The merge of develop into the electron bump branch (6751468, merged by #1118) then brought queue 6.0.2 back without inherits. npm reuses the locked queue and doesn't add its missing dependency, so inherits is never installed.

Fix

  • Set image-size back to ^1.2.1 in src/ElectronNET.Host/package.json. This matches the template and main.js, which calls imageSize(file, callback). In 2.x, imageSize takes a buffer and reading from a file moved to imageSizeFromFile in image-size/fromFile.
  • Regenerate package-lock.json. This restores image-size 1.2.1 and inherits 2.0.4, and drops two orphaned dev entries (quick-lru, resolve-alpn). No other package versions change.

Moving to image-size 2.x would also work, but it needs main.js and the template changed together, plus a splash screen check, so I kept this PR to the repair.

Testing

Locally on Linux with Electron 38.2.2:

  • Replaying the .electron install with npm 10.9.9 and the current develop lockfile reproduces the CI failure: inherits is missing and require('image-size') throws the same error.
  • With this change, the build installs inherits and the integration suite passes: 102 passed, 18 skipped, 0 failed.
  • With Fix host hang when Electron exits before the socket bridge connects #1124 merged on top: 112 passed, 18 skipped, 0 failed.

I haven't run this on Windows or macOS; the CI matrix on this PR covers those.

Some earlier runs had unrelated failures in one or two tests (DevTools_check, and timeouts in DomReady_event_fires and ExecuteJavaScript_returns_title), so a single red test here may be that flakiness rather than this issue.

🤖 Generated with Claude Code

The merge of ElectronNET#1118 left package-lock.json with queue 6.0.2 but without its
dependency inherits. The build copies this lockfile next to the generated
package.json, which requests image-size ^1.2.1, so npm reuses the locked
queue, never installs inherits, and Electron fails at startup with
"Cannot find module 'inherits'".

Go back to image-size ^1.2.1 in the Host: it matches package.template.json
and the callback API that main.js uses, which 2.x no longer provides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DYH1319

DYH1319 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

The only failure is DevTools_check on macos-15-intel / Electron 30.4.0 (1 of 1680 tests). It's the flaky test mentioned in the description, and the Electron startup failure is gone on all 14 runners. A re-run of that job should clear it.

@FlorianRappl FlorianRappl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Much appreciated!

@FlorianRappl
FlorianRappl merged commit 6384f23 into ElectronNET:develop Nov 5, 2026
16 of 17 checks passed
@DYH1319

DYH1319 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for merging! The tests are green on develop now. The Build and Publish run still failed, but only at the NuGet push: nuget.org returned 403 for NUGET_API_KEY (run 41983032478). The key probably needs checking or rotating.

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.

2 participants