Skip to content

fix(cli): detect Bun on Windows in launcher (which → where)#131

Open
Trypd wants to merge 1 commit into
MadAppGang:mainfrom
Trypd:fix/windows-bun-detection
Open

fix(cli): detect Bun on Windows in launcher (which → where)#131
Trypd wants to merge 1 commit into
MadAppGang:mainfrom
Trypd:fix/windows-bun-detection

Conversation

@Trypd

@Trypd Trypd commented May 28, 2026

Copy link
Copy Markdown

Problem

On Windows, claudish fails to launch even when Bun is installed and on PATH:

'which' is not recognized as an internal or external command,
operable program or batch file.
claudish requires the Bun runtime but it was not found.

bin/claudish.cjs findBun() is POSIX-only:

  1. execSync("which bun")which doesn't exist in cmd/PowerShell, so the lookup throws.
  2. The fallback candidates are all Unix paths ($HOME/.bun/bin/bun, /usr/local/bin/bun, /opt/homebrew/bin/bun) — none match the Windows install location %USERPROFILE%\.bun\bin\bun.exe.
  3. process.env.HOME is typically unset on Windows (it's USERPROFILE), so even the first candidate resolves to undefined/.bun/bin/bun.

Net effect: a correctly installed Bun is reported as missing on every Windows machine.

Fix

  • Use where bun on win32, which bun elsewhere; take the first returned line.
  • Add Windows fallback candidates %USERPROFILE%\.bun\bin\bun.exe (and extensionless), using HOME || USERPROFILE.
  • Make the "install Bun" hint platform-aware — Windows users get the PowerShell one-liner (irm bun.sh/install.ps1 | iex) instead of curl … | bash.

No behavior change on macOS/Linux (same which path and same Unix candidates).

Testing

  • Windows 11 + Bun 1.3.13 on PATH: claudish --versionclaudish version 7.1.2 (was failing before).
  • node --check bin/claudish.cjs passes.

findBun() used `which bun`, which is POSIX-only, so on Windows the
PATH lookup throws and falls through to Unix-only candidate paths
($HOME/.bun/bin/bun, /usr/local/bin, /opt/homebrew). HOME is also
usually unset on Windows. Result: even with Bun installed and on
PATH, the launcher reports "Bun runtime not found".

- Use `where bun` on win32, `which bun` elsewhere; take first line.
- Fall back to %USERPROFILE%\.bun\bin\bun.exe (HOME || USERPROFILE).
- Make the install hint platform-aware (PowerShell one-liner on Windows).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant