Auto-updater incorrectly detects native install as npm-global after migration from npm
Summary
After migrating from an npm global install to a native install of Claude Code, the AutoUpdaterWrapper still detects the installation type as npm-global, which causes auto-updates to be silently skipped. The user only discovers new versions through external channels (e.g., social media) rather than through the built-in auto-updater.
Environment
- OS: macOS (arm64)
- Claude Code version: 2.1.89 (latest at time of report)
- Binary location:
~/.local/bin/claude(Mach-O arm64 executable) - Versions directory:
~/.local/share/claude/versions/(exists, contains version binaries) - npm global packages: empty —
npm list -gshows no@anthropic-ai/claude-codeentry
Steps to Reproduce
- Install Claude Code via npm:
npm install -g @anthropic-ai/claude-code - Later, switch to the native install (e.g., via
claude updateor direct download to~/.local/bin/claude) - Remove the npm global package (or let it become stale/removed)
- Run Claude Code and enable debug logging
- Observe that auto-updates are skipped
Debug Log (relevant lines)
AutoUpdaterWrapper: Installation type: npm-global
Plugin autoupdate: skipped (auto-updater disabled)
Expected Behavior
After switching to a native install, AutoUpdaterWrapper should:
- Detect that the binary at
~/.local/bin/claudeis a native (non-npm) install - Enable auto-updates accordingly
- Notify the user when a new version is available
Actual Behavior
AutoUpdaterWrapper reports Installation type: npm-global even though:
- The npm global package has been removed (
npm list -gis empty) - The binary is a Mach-O arm64 executable located at
~/.local/bin/claude - The versions directory
~/.local/share/claude/versions/exists with version binaries
As a result, auto-updates are silently disabled. The user had to run claude update manually after learning about a new version through social media.
Root Cause (hypothesis)
The installation type detection logic in AutoUpdaterWrapper likely caches or incorrectly infers the install method — possibly by checking a stale config value, inspecting the binary path in a way that matches an npm pattern, or failing to detect the native install directory structure. It does not appear to re-evaluate based on the current binary location or the presence of the native ~/.local/share/claude/versions/ directory.
Suggested Fix
The detection logic should:
- Check whether the binary resolves to a path inside a known npm prefix (e.g., via
npm prefix -gornpm root -g) at runtime, not rely on a cached/historical value - Fall back to native install detection if the npm global package is not found
- Alternatively, prefer native install detection when the versions directory (
~/.local/share/claude/versions/) is present
Impact
Users who migrate from npm to native install lose silent auto-update functionality without any warning. This is a silent failure — there is no UI notification that auto-updates have been disabled, and the user has no way to know they are running an outdated version until they check manually.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗