From 278414a0a72c55bc0e0c4b936a25d9668f31ef97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=82CHES?= Date: Sat, 14 Mar 2026 21:24:08 -0600 Subject: [PATCH] fix: detect WSL + Windows Node.js mismatch and warn user (closes #1021) (#1049) Co-authored-by: Claude Opus 4.6 (1M context) --- bin/install.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/bin/install.js b/bin/install.js index 174742550..f66f45a8a 100755 --- a/bin/install.js +++ b/bin/install.js @@ -81,6 +81,40 @@ if (hasAll) { if (hasCopilot) selectedRuntimes.push('copilot'); } +// WSL + Windows Node.js detection +// When Windows-native Node runs on WSL, os.homedir() and path.join() produce +// backslash paths that don't resolve correctly on the Linux filesystem. +if (process.platform === 'win32') { + let isWSL = false; + try { + if (process.env.WSL_DISTRO_NAME) { + isWSL = true; + } else if (fs.existsSync('/proc/version')) { + const procVersion = fs.readFileSync('/proc/version', 'utf8').toLowerCase(); + if (procVersion.includes('microsoft') || procVersion.includes('wsl')) { + isWSL = true; + } + } + } catch { + // Ignore read errors — not WSL + } + + if (isWSL) { + console.error(` +${yellow}⚠ Detected WSL with Windows-native Node.js.${reset} + +This causes path resolution issues that prevent correct installation. +Please install a Linux-native Node.js inside WSL: + + curl -fsSL https://fnm.vercel.app/install | bash + fnm install --lts + +Then re-run: npx get-shit-done-cc@latest +`); + process.exit(1); + } +} + /** * Convert a pathPrefix (which uses absolute paths for global installs) to a * $HOME-relative form for replacing $HOME/.claude/ references in bash code blocks.