/doctor reports phantom "npm-global" install when npm prefix shares ~/.local/bin with native installer
Description
/doctor flags my native install as a duplicate npm-global install. Both rows in the warning point to the same path (the native installer's symlink), and npm -g uninstall @anthropic-ai/claude-code is a no-op because there is no npm package — only the native binary.
Diagnostics output
⚠ Multiple installations found
├ npm-global at /Users/me/.local/bin/claude
└ native at /Users/me/.local/bin/claude
⚠ Leftover npm global installation at /Users/me/.local/bin/claude
└ Run: npm -g uninstall @anthropic-ai/claude-code
Environment
- macOS (Darwin 25.4.0), zsh
- Claude Code
2.1.131,installMethod: "native",autoUpdates: false npm config get prefix→/Users/me/.local← so npm's global-bin dir is/Users/me/.local/bin/readlink ~/.local/bin/claude→/Users/me/.local/share/claude/versions/2.1.131(native install target)npm ls -g @anthropic-ai/claude-code→ empty~/.local/lib/node_modules/@anthropic-ai/does not exist
Root cause (best guess)
The detector appears to treat "binary present in \\$(npm config get prefix)/bin\" as proof of an npm install. When a user's npm prefix happens to be ~/.local (a common XDG-ish layout), it collides with the native installer's symlink directory and produces a false positive.
Suggested fix
Before declaring a binary an npm install, verify the symlink target is under node_modules/@anthropic-ai/.... If readlink resolves to ~/.local/share/claude/versions/<v>/, classify as native regardless of which directory the symlink itself sits in.
Reproduction
npm config set prefix ~/.local
# install Claude Code via the native installer (drops symlink at ~/.local/bin/claude)
claude
> /doctor
Workaround
Move npm prefix off ~/.local (npm config set prefix ~/.npm-global + PATH update). Otherwise harmless — the native install works correctly.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗