update command downloads 0-byte binary when native and npm-global installs coexist

Resolved 💬 2 comments Opened Mar 22, 2026 by gmelli Closed Apr 20, 2026

Bug Report

Description

When Claude Code is installed via both the native installer (~/.local/share/claude/versions/) and npm global (npm install -g @anthropic-ai/claude-code), the claude update command exhibits three compounding failures:

  1. 0-byte download: claude update downloads the new version as a 0-byte file to ~/.local/share/claude/versions/{new_version}
  2. Symlink not repointed: The symlink at ~/.local/bin/claude continues pointing to the old version directory
  3. Misleading version report: After the failed update, running claude update again reports "Current version: {new_version}" despite the binary still being the old version

Steps to Reproduce

  1. Install Claude Code via the native installer (creates ~/.local/bin/claude symlink → ~/.local/share/claude/versions/X.Y.Z)
  2. Also install via npm: npm install -g @anthropic-ai/claude-code (creates /opt/homebrew/bin/claude)
  3. Use a shell alias that explicitly invokes ~/.local/bin/claude (native)
  4. Run: ~/.local/bin/claude update

Expected Behavior

  • Update downloads a valid binary for the new version
  • Symlink is repointed to the new version
  • claude --version reflects the new version

Actual Behavior

  • Update detects "Configuration mismatch" (config says global, running native) and fixes config
  • New version directory is created at ~/.local/share/claude/versions/{new} but the file is 0 bytes
  • Symlink at ~/.local/bin/claude still points to old version
  • Subsequent claude update reports new version as current (reading from config, not binary)

Diagnostic Evidence

$ ls -la ~/.local/share/claude/versions/
2.1.17  2.1.42  2.1.81   # 2.1.81 is 0 bytes

$ ls -la ~/.local/bin/claude
claude -> ~/.local/share/claude/versions/2.1.42   # still old

$ ~/.local/bin/claude --version
2.1.42 (Claude Code)   # old version still active

Workaround

  1. Run claude update a second time (succeeded on second attempt)
  2. Remove the npm global installation: npm -g uninstall @anthropic-ai/claude-code

Environment

  • macOS (Darwin 24.6.0, Apple Silicon)
  • Node.js via Homebrew
  • Native install at ~/.local/bin/claude
  • npm global install at /opt/homebrew/bin/claude
  • Updating from v2.1.42 to v2.1.81

Suggestions

  1. Validate downloaded binary size > 0 before considering update successful
  2. Verify symlink was actually repointed after update
  3. Report --version from the actual binary, not from config
  4. Warn at startup if dual installations are detected (native + npm global)

View original on GitHub ↗

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