False positive "Multiple installations found" warning when npm prefix is set to ~/.local
Description
When running claude update, a false warning about multiple installations is displayed, even though only the native installation exists.
Environment
- OS: Debian 13 (trixie)
- Claude Code version: 2.1.78
- Installation method: Native (installed via official installer)
- npm prefix:
~/.local(set in~/.npmrcto avoid requiringsudofor global installs)
Steps to Reproduce
- Set npm global prefix to
~/.localin~/.npmrc:
````
prefix=~/.local
- Install Claude Code using the native installer (not via npm)
- Run
claude update
Actual Behavior
$ claude update
Current version: 2.1.78
Checking for updates to latest version...
Warning: Multiple installations found
- npm-global at ~/.local/bin/claude
- native at ~/.local/bin/claude (currently running)
Warning: Leftover npm global installation at ~/.local/bin/claude
Fix: Run: npm -g uninstall @anthropic-ai/claude-code
Claude Code is up to date (2.1.78)
However, there is no npm global installation of claude-code:
$ npm ls -g @anthropic-ai/claude-code
~/.local/lib
└── (empty)
$ which -a claude
~/.local/bin/claude
$ readlink -f ~/.local/bin/claude
~/.local/share/claude/versions/2.1.78
The binary at ~/.local/bin/claude is a symlink created by the native installer, pointing to ~/.local/share/claude/versions/2.1.78.
Expected Behavior
No warning should be shown, since there is only one installation (native).
Root Cause Analysis
The update checker appears to detect installations by checking if a claude binary exists at the npm global bin path ($(npm prefix -g)/bin/). When the user has set npm prefix to ~/.local (a common setup to avoid sudo for global npm installs), this path overlaps with where the native installer places its symlink (~/.local/bin/claude). The checker then incorrectly flags the native installation's own symlink as a separate npm-global installation.
Suggested Fix
The detection logic should verify that an actual npm package exists (e.g., check for $(npm prefix -g)/lib/node_modules/@anthropic-ai/claude-code/) rather than only checking for the binary at the npm global bin path.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗