/doctor falsely reports native install as 'leftover npm global installation' when npm prefix is ~/.local

Resolved 💬 4 comments Opened May 5, 2026 by ManolisMaroudas Closed May 9, 2026

Title: /doctor falsely reports native install as "leftover npm global installation" when npm prefix is ~/.local

Version: Claude Code 2.1.128 (native installer, Linux x86_64)

_This bug report was drafted by Claude Code on behalf of the reporter, based on diagnostic commands run in the user's shell. The reporter reviewed it before filing._

Summary

/doctor reports Leftover npm global installation at ~/.local/bin/claude and suggests npm -g uninstall @anthropic-ai/claude-code, but the binary at that path is the active native installation, not an npm leftover. Running the suggested command is a no-op (npm has no such package installed) and, if a user follows up by deleting the symlink manually, it breaks their working install.

Environment

  • OS: Linux 6.8.0-107-generic (Ubuntu)
  • Shell: bash
  • Install method: native installer (~/.local/share/claude/versions/<ver>)
  • npm config: prefix = /home/<user>/.local — npm and the native installer share the same bin directory. This is a common setup to avoid sudo for global npm installs.

Steps to reproduce

  1. npm config set prefix ~/.local (or have it set this way already).
  2. Install Claude Code via the native installer (not npm). Result: ~/.local/bin/claude is a symlink to ~/.local/share/claude/versions/<ver> (an ELF binary).
  3. Run /doctor.

Expected

Doctor recognizes a native install (symlink target lives under ~/.local/share/claude/versions/) and does not flag it.

Actual

Leftover npm global installation at /home/<user>/.local/bin/claude Suggested fix: Run: npm -g uninstall @anthropic-ai/claude-code

The npm package is not actually installed:

$ npm ls -g @anthropic-ai/claude-code
/home/<user>/.local/lib
└── (empty)

Diagnostic output

$ ls -la ~/.local/bin/claude
lrwxrwxrwx ... /home/<user>/.local/bin/claude -> /home/<user>/.local/share/claude/versions/2.1.128

$ file ~/.local/share/claude/versions/2.1.128
ELF 64-bit LSB executable, x86-64, ... dynamically linked

$ npm config get prefix
/home/<user>/.local

$ npm root -g
/home/<user>/.local/lib/node_modules

Suggested fix

Before flagging <bin>/claude as an npm leftover, resolve the symlink and check whether the target lives under <npm root -g>/@anthropic-ai/claude-code/ (npm-managed) versus <XDG_DATA_HOME>/claude/versions/ (native-managed). Equivalent quick check: only flag as npm leftover if npm ls -g @anthropic-ai/claude-code actually lists the package.

Impact

  • Confusing for users on the common npm prefix=~/.local setup.
  • Suggested command is a no-op.
  • A user who escalates to rm the symlink based on the wording will break their working installation.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗