Git Bash shim for `claude` fails with mixed-separator path on Windows (MSYS)

Open 💬 0 comments Opened Jun 11, 2026 by husseinb2

Bug

Running claude from Git Bash on Windows fails:

/c/Users/<user>/AppData/Roaming/npm/claude: line 12: C:\Users\<user>\AppData\Roaming\npm/node_modules/@anthropic-ai/claude-code/bin/claude.exe: No such file or directory

The .exe does exist at that path. The npm-generated sh shim at %APPDATA%\npm\claude runs cygpath -w on the basedir, producing a backslash Windows path, then concatenates a forward-slash suffix. The resulting mixed-separator string can't be resolved by MSYS bash's exec.

claude.cmd and claude.ps1 are unaffected; only the Git Bash entry point breaks.

Environment

  • @anthropic-ai/claude-code@2.1.173
  • Windows 11 Pro (10.0.26200)
  • Git Bash: MINGW64_NT 3.6.6, bash 5.2.37(1)
  • Installed via npm i -g @anthropic-ai/claude-code

Repro

  1. In Git Bash on Windows: npm i -g @anthropic-ai/claude-code
  2. Run claude --version from Git Bash.

Expected: prints version. Actual: No such file or directory.

The shim

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")

case `uname` in
    *CYGWIN*|*MINGW*|*MSYS*)
        if command -v cygpath > /dev/null 2>&1; then
            basedir=`cygpath -w "$basedir"`
        fi
    ;;
esac

exec "$basedir/node_modules/@anthropic-ai/claude-code/bin/claude.exe"   "$@"

After cygpath -w, basedir is C:\Users\<user>\AppData\Roaming\npm. The exec target becomes C:\Users\<user>\AppData\Roaming\npm/node_modules/@anthropic-ai/claude-code/bin/claude.exe — mixed separators, which MSYS bash refuses.

Workaround

Manually edit %APPDATA%\npm\claude and change cygpath -w to cygpath -m (forward-slash Windows path). Gets overwritten on every reinstall.

Note on root cause

The broken shim is generated by npm's cmd-shim, not authored by Anthropic — but it breaks specifically because the bin target is claude.exe. A small JS wrapper as the bin (or a postinstall that rewrites the sh shim to use cygpath -m) would fix it for Git Bash users.

View original on GitHub ↗