From bbb7ba7b077909a466669035312825b91dd1c710 Mon Sep 17 00:00:00 2001 From: Josh Gratton Date: Fri, 12 Jun 2026 14:22:24 -0400 Subject: [PATCH] fix(desktop): unpack the full node_modules tree for the WSL backend The WSL backend launches the server with the distro's own Linux Node, which can't read inside app.asar. asarUnpack only covered the server bundle and node-pty, but bin.mjs externalizes its runtime dependencies (effect, @effect/*, ...) to node_modules rather than inlining them. So the Linux Node crashed with ERR_MODULE_NOT_FOUND ("Cannot find package 'effect'") before it even reached node-pty, which left WSL-only mode unable to launch (the node-pty preflight had already passed, so there was no Windows fallback). Unpack the whole node_modules tree so every server import resolves on the real filesystem. The Windows primary keeps reading the same files through the asar via ELECTRON_RUN_AS_NODE, so there's no duplication. --- scripts/build-desktop-artifact.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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);