Repository navigation
fix: package Electron runtime deps - #1639
diegosouzapw merged 3 commits into
Conversation
cheaper-inference#1630) Cherry-pick from PR cheaper-inference#1630 by @rdself. Fixes Docker build failures caused by lockfile peer dependency mismatch during npm ci.
…ailures - Override plist to v4.0.0 which passes mandatory mimeType to DOMParser - Add USERPROFILE sanitization on Windows to avoid EPERM on junction points - Add NPM_CONFIG_LEGACY_PEER_DEPS to Electron workflow install step
There was a problem hiding this comment.
Code Review
This pull request introduces a smoke test for the packaged Electron application and ensures that standalone runtime dependencies are correctly included in the build. Key changes include the addition of a macOS-specific smoke test script, a corresponding npm script, and a unit test to verify the packaging configuration. Feedback was provided to extend the smoke test script to support Windows and Linux platforms, ensuring consistent validation across all target environments.
| if (platform() !== "darwin") { | ||
| throw new Error("Packaged Electron smoke check currently supports macOS .app bundles only."); | ||
| } |
There was a problem hiding this comment.
The smoke test is currently restricted to macOS. Since the application is also built for Windows and Linux (as seen in electron/package.json), consider extending this script to support these platforms. This would involve adjusting the executable discovery logic to look for .exe on Windows or the binary name on Linux, ensuring consistent validation across all target environments.
4b3026b to
d1054a9
Compare
|
Addressed the review feedback in d1054a9. The packaged smoke script now discovers and launches macOS, Windows, and Linux unpacked Electron builds. The release workflow runs it on every Electron build matrix entry; Linux uses xvfb-run so the packaged app can start under CI. |
Fork-Patch: electron-standalone-runtime-deps Reason: the packaged desktop app starts server.js from resources/app, so the standalone Next runtime dependencies must be present under resources/app/node_modules.
d1054a9 to
29af01f
Compare
|
Addressed the follow-up review items in 29af01f. Changes made:
Local validation passed: unit tests for packaging/smoke helpers, |
56ae1b8
into
cheaper-inference:release/v3.7.1
|
Thanks @prateek for this comprehensive fix! 🎉 The separate |
Integrated into release/v3.7.1 — fixes Electron installer shipping empty node_modules. Adds separate extraResources FileSet, CI smoke test job, and cross-platform packaged app validation script. Closes cheaper-inference#1636.
Integrated into release/v3.7.1 — fixes Electron installer shipping empty node_modules. Adds separate extraResources FileSet, CI smoke test job, and cross-platform packaged app validation script. Closes cheaper-inference#1636.
Integrated into release/v3.7.1 — fixes Electron installer shipping empty node_modules. Adds separate extraResources FileSet, CI smoke test job, and cross-platform packaged app validation script. Closes cheaper-inference#1636.
Summary
Fix the packaged Electron app startup failure where
server.jsis present but runtime dependencies such asnextare missing fromresources/app/node_modules.The previous v3.7.0 fix added
node_modules/**/*to the parentextraResourcesfilter, but release artifacts can still ship an emptyresources/app/node_modules. This adds a separateextraResourcesFileSet that names the standalonenode_modulesdirectory directly.Closes #1636.
Refs #1492.
Why
The Electron main process starts the packaged Next standalone server from
resources/app/server.js. That server needs the standalone runtime dependencies underresources/app/node_modules.Without them, the server exits with:
Cannot find module 'next'The Electron window then loads a dead local URL and appears as a black screen.
Changes
.next/electron-standalone/node_modulesdirectly toresources/app/node_modules.better-sqlite3handled byapp.asar.unpacked/node_modules..app, waits for/loginto return HTTP 200, and fails on startup module-load errors.Validation
node --import tsx/esm --test tests/unit/electron-packaging.test.tsnpm run buildCSC_IDENTITY_AUTO_DISCOVERY=false npm run pack --prefix electronnpm run electron:smoke:packagedThe smoke test confirms the packaged app starts, serves
/login, and does not emitMODULE_NOT_FOUND/Cannot find modulestartup errors.