Auto-updater crashes and corrupts installation, leaving claude command broken

Resolved 💬 3 comments Opened Feb 7, 2026 by ilanoh Closed Feb 11, 2026

Problem

The npm auto-updater frequently crashes mid-update, leaving the global installation in a broken state:

  1. Auto-update triggers during normal usage
  2. It deletes the current installation
  3. The install of the new version fails or gets interrupted
  4. claude command is now gone — the binary was deleted but nothing replaced it
  5. Running npm install -g @anthropic-ai/claude-code after this sometimes creates duplicates or hits permission errors because npm still has a ghost entry for the old install

This has happened multiple times. The result is being locked out of Claude Code until manually cleaning up node_modules and reinstalling.

Expected behavior

The auto-updater should be atomic: download the new version fully to a temp location, verify it, then swap the symlink. If anything fails, the old version should remain intact and functional. The current approach of delete-then-install is inherently fragile.

Current workarounds (all have drawbacks)

  • Disable auto-update (CLAUDE_CODE_DISABLE_AUTO_UPDATE=1) — works but then you have to manually update, defeating the purpose
  • Use brew — atomic upgrades but always days behind npm releases
  • Use npx — has its own caching/version resolution bugs

Environment

  • macOS (Darwin)
  • Node.js installed via standard methods
  • npm global install (npm install -g @anthropic-ai/claude-code)

Suggestion

Implement atomic updates — download new version to a staging directory, verify integrity, then atomically replace the old version. If the download or verification fails, keep the existing working installation. This is how tools like Volta, Rustup, and Homebrew handle updates.

View original on GitHub ↗

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