[BUG] npm install may conflict with native install
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
If the npm install has the same prefix (~/.local) as the native install, then claude doctor thinks the former is the latter and that both are installed, and claude install doesn't uninstall the former and install the latter.
What Should Happen?
claude doctor should realize I'm running npm-global (not native) and that native isn't installed.
claude install should uninstall npm-global and install native.
Error Messages/Logs
$ claude doctor
Diagnostics
└ Currently running: native (1.0.115)
└ Path: /usr/local/bin/node
└ Invoked: ~/.local/bin/claude
└ Config install method: unknown
└ Auto-updates enabled: default (true)
└ Search: OK (vendor)
Warning: Multiple installations found
└ npm-global at ~/.local/bin/claude
└ native at ~/.local/bin/claude
Warning: Running native installation but config install method is 'unknown'
Fix: Run claude install to update configuration
Warning: Leftover npm global installation at ~/.local/bin/claude
Fix: Run: npm -g uninstall @anthropic-ai/claude-code
Steps to Reproduce
- Run
npm install -g --prefix ~/.local @anthropic-ai/claude-code - Run
claude doctor - Run
claude install
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
1.0.115 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Claude Docs: Set up Claude Code: Standard installation says: "Do NOT use sudo npm install -g", but on macOS, you need to use sudo to write to npm's default global prefix (/usr/local), so I ran npm config set prefix=~/.local before running npm install. But to simplify the "Steps to Reproduce" (above), I just added --prefix ~/.local to npm install (in step 1).
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Can confirm, I have the same issue, and can't get rid of the warning, even though I uninstalled claude with npm before installing the native one
@skogler, after you install Claude Code globally with npm and run
claudefor the first time, Claude Code creates the configuration files~/.claude,~/.claude.json, and~/.claude.json.backup. Uninstalling Claude Code withnpm uninstalldoesn't remove those files, which maybenpm uninstallshould mention. (It also doesn't remove the empty directory~/.local/lib/node_modules/@anthropic-ai, and maybe it should.) After reviewing the contents of those files, I simply deleted them, but you may want to back them up first, if you think they're important.I haven't tried this, but maybe you could get rid of the warning like this:
This should be resolved in the next release.
Awesome! Thanks!
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.