Skip to content

Commit 2134d96

Browse files
author
tsouth89
committed
fix(wsl): probe an external package, not one the bundle now inlines
The WSL health probe resolved "effect" to confirm the server's dependencies were unpacked on the real filesystem. That premise held while the bundle externalized its runtime deps and the whole node_modules tree was unpacked. This branch inlines those dependencies, so "effect" no longer exists on disk. The probe therefore exits 3 and wsl-only mode refuses to launch, reporting a packaging regression that isn't one. Resolve node-pty instead: it is external precisely because it cannot be inlined, so it is a valid sentinel for the unpacked tree both before and after this change. Verified against the packaged tree, where require.resolve("effect") fails with MODULE_NOT_FOUND and require.resolve("node-pty/package.json") succeeds. Reported by @ikifar2012, who hit it running wsl-only mode from this branch.
1 parent 12a5bf0 commit 2134d96

1 file changed

Lines changed: 18 additions & 14 deletions

File tree

‎apps/desktop/src/wsl/DesktopWslEnvironment.ts‎

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,18 @@ const NODE_PTY_PROBE_SCRIPT = (
229229
printf 'nodeVersion:%s\\n' "$(node -p 'process.versions.node' 2>/dev/null)"
230230
printf 'resolvedPath:%s\\n' "$PATH"
231231
cd ${shellQuote(linuxServerDir)} && node <<'NODE' >/dev/null 2>&1
232-
// The server bundle externalizes its deps to node_modules, and the WSL Node
233-
// can't read inside app.asar, so confirm those deps are unpacked on the real
234-
// filesystem before reporting the backend healthy. "effect" is the framework
235-
// every server module imports; resolving it validates the whole node_modules
236-
// tree. Exit 3 marks this distinct from a node-pty problem so the caller can
237-
// report it accurately instead of letting the server crash on
238-
// ERR_MODULE_NOT_FOUND at launch (which, in wsl-only mode, would just fail to
239-
// launch with no fallback).
240-
try { require.resolve("effect"); } catch (_e) { process.exit(3); }
232+
// The WSL Node can't read inside app.asar, so confirm what the server needs is
233+
// unpacked on the real filesystem before reporting the backend healthy. Exit 3
234+
// marks this distinct from a node-pty prebuild problem so the caller can report
235+
// it accurately instead of letting the server crash on ERR_MODULE_NOT_FOUND at
236+
// launch (which, in wsl-only mode, would just fail to launch with no fallback).
237+
//
238+
// The sentinel must be a package the CLI bundle leaves external. It used to be
239+
// "effect", back when the bundle externalized its runtime deps and the whole
240+
// node_modules tree was unpacked. The bundle now inlines its JS dependencies,
241+
// so "effect" no longer exists on disk and only the native packages do —
242+
// resolving node-pty is what actually validates the unpacked tree.
243+
try { require.resolve("node-pty/package.json"); } catch (_e) { process.exit(3); }
241244
const fs = require("node:fs");
242245
const path = require("node:path");
243246
const pkgDir = path.dirname(require.resolve("node-pty/package.json"));
@@ -462,11 +465,12 @@ const ensureNodePtyImpl = (
462465
} as const;
463466
}
464467

465-
// Server dependencies (e.g. "effect") couldn't be resolved on the WSL
466-
// filesystem — a packaging regression, since the server bundle needs its
467-
// node_modules unpacked from the asar. Fatal so wsl-only mode falls back to
468-
// Windows and dual mode surfaces the reason inline, instead of the server
469-
// crash-looping on ERR_MODULE_NOT_FOUND once it actually launches.
468+
// The packages the server bundle leaves external (node-pty and the other
469+
// native addons) couldn't be resolved on the WSL filesystem — a packaging
470+
// regression, since those must be unpacked from the asar. Fatal so wsl-only
471+
// mode falls back to Windows and dual mode surfaces the reason inline,
472+
// instead of the server crash-looping on ERR_MODULE_NOT_FOUND once it
473+
// actually launches.
470474
if (probe.exitCode === 3) {
471475
return {
472476
ok: false,

0 commit comments

Comments
 (0)