diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts index a3c383ed43..41a74b062c 100644 --- a/scripts/build-desktop-artifact.ts +++ b/scripts/build-desktop-artifact.ts @@ -711,11 +711,16 @@ const createBuildConfig = Effect.fn("createBuildConfig")(function* ( // The Windows primary backend runs the server bundle through // ELECTRON_RUN_AS_NODE (asar-aware), so it reads bin.mjs straight out of // app.asar. The WSL backend instead launches plain `wsl.exe -- node`, which - // cannot read inside an asar archive — it needs the server bundle and - // node-pty on the real filesystem. Unpack both to app.asar.unpacked (the - // Windows primary's asar reads are transparently redirected to the same - // unpacked copy, so there's no duplication). - asarUnpack: ["apps/server/dist/**", "**/node_modules/node-pty/**/*"], + // cannot read inside an asar archive, so everything it loads must be on the + // real filesystem. The server bundle externalizes its runtime dependencies + // (effect, @effect/*, node-pty, ...) to node_modules rather than inlining + // them, so unpacking just the bundle + node-pty isn't enough — the Linux Node + // fails with ERR_MODULE_NOT_FOUND (e.g. "Cannot find package 'effect'") before + // it even reaches node-pty. Unpack the server bundle AND the whole + // node_modules tree so every import resolves. The Windows primary keeps + // reading the same files through the asar (transparently redirected to the + // unpacked copy), so there's no duplication. + asarUnpack: ["apps/server/dist/**", "**/node_modules/**"], }; const updateChannel = resolveDesktopUpdateChannel(version); const publishConfig = resolveGitHubPublishConfig(updateChannel);