[Bug] Update process incorrectly switches to npm-local mode with legacy npm cache

Resolved 💬 3 comments Opened Jan 29, 2026 by itay-sadov Closed Feb 2, 2026

Bug Description
Title: Update process incorrectly switches to npm-local mode when old npm cache entries exist

Description
After every Claude Code update, the installation switches from native to npm-local mode, causing a config mismatch. This requires manual intervention after each update to restore
proper operation.

Environment

  • OS: Linux (Ubuntu)
  • Claude Code version: 2.1.23
  • Installation method: native

Steps to Reproduce

  1. Have a native Claude Code installation
  2. Previously have had an npm-based Claude Code installation (historical)
  3. Update Claude Code to a new version
  4. Run claude doctor

Expected Behavior

claude doctor shows consistent native installation with no warnings.

Actual Behavior

claude doctor shows config mismatch - running as npm-local while config specifies native. The CLI may fail to work properly until manually fixed.

Root Cause Analysis

Found 23 old @anthropic-ai/claude-code packages in the npm cache from a previous npm-based installation:
~/.npm/_cacache/content-v2/sha512/...

The update process appears to detect these cached packages and incorrectly switches to npm-local mode, overriding the native installation config.

Workaround

npm cache clean --force
rm -rf ~/.claude/local
claude install

This resolves the issue until the next update.

Suggested Fix(generated by claude code)

The updater should respect the configured installation method rather than auto-detecting based on npm cache presence. Options:

  1. Check config.json install method before deciding update strategy
  2. Clean up npm cache artifacts when user has native installation
  3. Add detection/warning in claude doctor when this mismatch condition exists

View original on GitHub ↗

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