claude-code - 💡(How to fix) Fix [BUG] `claude update` falsely reports leftover npm global install when native launcher is in npm global prefix directory [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56399Fetched 2026-05-06 06:29:07
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×5unlabeled ×1

Error Message

Error Messages/Logs

Code Example

~/.local/bin/claude -> ~/.local/share/claude/versions/2.1.128

---

npm list -g --depth=0 @anthropic-ai/claude-code
# empty / not installed

---

npm -g uninstall @anthropic-ai/claude-code
# up to date

### What Should Happen?

If `@anthropic-ai/claude-code` is not installed in the npm global package tree, `claude update` should not report a leftover npm global installation.

It should recognize the launcher as native when:

---

$ claude update
Current version: 2.1.128
Checking for updates to latest version...

Warning: Multiple installations found
- npm-global at /home/<user>/.local/bin/claude
- native at /home/<user>/.local/bin/claude (currently running)

Warning: Leftover npm global installation at /home/<user>/.local/bin/claude
Fix: Run: npm -g uninstall @anthropic-ai/claude-code
Claude Code is up to date (2.1.128)

$ npm -g uninstall @anthropic-ai/claude-code

up to date in 123ms

---

curl -fsSL https://claude.ai/install.sh | bash

---

npm prefix -g
   # /home/<user>/.local

---

ls -l ~/.local/bin/claude
   # ~/.local/bin/claude -> ~/.local/share/claude/versions/2.1.128

---

npm list -g --depth=0 @anthropic-ai/claude-code
   # empty / not installed

---

claude update

---

NPM_CONFIG_PREFIX="$HOME/.npm-global" claude update
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

claude update reports a leftover npm global installation even when @anthropic-ai/claude-code is not installed via npm.

This appears to happen when the native Claude Code launcher is installed at ~/.local/bin/claude and npm's global prefix is also ~/.local. Claude Code seems to classify the launcher path as npm-global based on the npm prefix/bin directory, even though the actual launcher is the native install symlink.

Verified local state:

~/.local/bin/claude -> ~/.local/share/claude/versions/2.1.128

The npm global package is absent:

npm list -g --depth=0 @anthropic-ai/claude-code
# empty / not installed

Running the suggested cleanup command is a no-op:

npm -g uninstall @anthropic-ai/claude-code
# up to date

### What Should Happen?

If `@anthropic-ai/claude-code` is not installed in the npm global package tree, `claude update` should not report a leftover npm global installation.

It should recognize the launcher as native when:

```text
~/.local/bin/claude -> ~/.local/share/claude/versions/<version>

### Error Messages/Logs

```shell
$ claude update
Current version: 2.1.128
Checking for updates to latest version...

Warning: Multiple installations found
- npm-global at /home/<user>/.local/bin/claude
- native at /home/<user>/.local/bin/claude (currently running)

Warning: Leftover npm global installation at /home/<user>/.local/bin/claude
Fix: Run: npm -g uninstall @anthropic-ai/claude-code
Claude Code is up to date (2.1.128)

$ npm -g uninstall @anthropic-ai/claude-code

up to date in 123ms

Steps to Reproduce

  1. Install Claude Code using the recommended native installer:

    curl -fsSL https://claude.ai/install.sh | bash
  2. Use an npm global prefix that resolves to ~/.local:

    npm prefix -g
    # /home/<user>/.local
  3. Verify the Claude launcher is native:

    ls -l ~/.local/bin/claude
    # ~/.local/bin/claude -> ~/.local/share/claude/versions/2.1.128
  4. Verify the deprecated npm package is not installed:

    npm list -g --depth=0 @anthropic-ai/claude-code
    # empty / not installed
  5. Run:

    claude update
  6. Observe that Claude Code reports both npm-global and native at the same launcher path and recommends npm -g uninstall @anthropic-ai/claude-code, even though the npm package is already absent.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

Unknown

Claude Code Version

2.1.128 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

The warning disappears if npm's prefix is overridden for the command:

NPM_CONFIG_PREFIX="$HOME/.npm-global" claude update

That suggests the detection is based on npm global prefix/path overlap rather than actual npm package presence.

Impact: this does not block updates, but it creates a persistent misleading warning and recommends a cleanup command that cannot resolve the issue.

extent analysis

TL;DR

The issue can be worked around by setting a different npm global prefix when running claude update to avoid the misleading warning about a leftover npm global installation.

Guidance

  • The warning is triggered by the overlap between the native Claude Code launcher path and the npm global prefix, rather than the actual presence of the npm package.
  • To verify this, check the output of npm prefix -g and compare it to the path of the Claude launcher.
  • To mitigate the issue, run claude update with a different npm global prefix, such as NPM_CONFIG_PREFIX="$HOME/.npm-global" claude update.
  • Consider setting a different npm global prefix permanently to avoid this issue in the future.

Example

No code snippet is necessary for this issue, as it can be resolved through environment variable configuration.

Notes

This workaround may not be suitable for all users, especially those who rely on the current npm global prefix for other packages. The root cause of the issue appears to be a detection problem in Claude Code, rather than an actual leftover npm global installation.

Recommendation

Apply workaround: set a different npm global prefix when running claude update, as this is a simple and effective way to avoid the misleading warning without affecting the functionality of Claude Code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] `claude update` falsely reports leftover npm global install when native launcher is in npm global prefix directory [1 participants]