claude install: binary resolves own path via npm prefix instead of native install path
Bug
claude install correctly installs the native binary to ~/.local/share/claude/versions/<version> and symlinks it at ~/.local/bin/claude, but the binary itself still resolves its own location by running npm -g config get prefix (which returns /usr/local), then looking for /usr/local/bin/claude. When that path doesn't exist, it fails — even though the binary is running fine from ~/.local/bin/claude.
Expected behavior
The native binary should use the path it was actually installed to (~/.local/bin/claude, computed by JRD() which does path.join(home, ".local", "bin")), not fall through to the npm global prefix path.
Reproduction
- Have npm's global prefix set to
/usr/local(the default on most Linux systems) - Run
claude install— binary goes to~/.local/bin/claude - Claude fails at startup, saying it can't find itself at
/usr/local/bin/claude - Workaround:
ln -s ~/.local/bin/claude /usr/local/bin/claude
Reproduced on two separate Linux machines (Debian-based, x86-64), Claude Code v2.1.37.
Root cause
The install type detection (mF1()) and doctor checks run npm -g config get prefix and check for <prefix>/bin/claude even when the installation type is native. The native install path (~/.local/bin) is hardcoded in JRD() and should be the sole source of truth for native installations — the npm prefix lookup should be skipped entirely for native installs.
Environment
- Platform: Linux x86-64 (Debian-based)
- Claude Code: 2.1.37 (native binary via
claude install) - npm prefix:
/usr/local - Native binary location:
~/.local/share/claude/versions/2.1.37 - Native symlink:
~/.local/bin/claude
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗