[BUG] Incorrect Installation Diagnostics for npm-global Installation

Status Open
Maintainer reply ✓ Yes — ant-kurt
Activity 13 comments · opened Sep 30, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code 2.0.1 shows incorrect installation diagnostic warnings when installed via npm install -g, claiming it's a "native" installation and reporting configuration mismatches, even though the installation is functioning correctly.

Environment
Claude Code Version: 2.0.1
Installation Method: npm global (npm install -g @anthropic-ai/claude-code)
OS: macOS
Node Version: v22.19.0
npm Version: 11.6.1

Installation Details

bash
$ which claude
/usr/local/bin/claude

$ ls -la /usr/local/bin/claude
lrwxr-xr-x  1 user  wheel  52 [date] /usr/local/bin/claude -> ../lib/node_modules/@anthropic-ai/claude-code/cli.js

$ npm list -g --depth=0 | grep claude
├── @anthropic-ai/claude-code@2.0.1

What Should Happen?

When installed via npm install -g, Claude Code should:

Correctly detect the installation method as npm-global
Not show warnings about native installation paths
Not report configuration mismatches between detected and actual installation method

Error Messages/Logs

**System Diagnostics**
  ⚠  installMethod is native, but claude command not found at /Users/[username]/.local/bin/claude
  ⚠  Insufficient permissions for auto-updates
  ⚠  No write permissions for auto-updates (requires sudo)
  ⚠  Installation config mismatch: running npm-global but config says native

Steps to Reproduce

  1. Install Claude Code globally: npm install -g @anthropic-ai/claude-code
  2. Verify installation: which claude (should show /usr/local/bin/claude)
  3. Create config file at ~/.claude/config.jsonwith:
json   {
"installMethod": "npm-global"
}
  1. Run claude in any project directory
  2. Observe the system diagnostics warnings

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.1 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Investigation Results
Looking at the compiled CLI code, the b$() function correctly detects npm-global based on the binary path:

javascriptif(["/usr/local/lib/node_modules", ...].some((Z)=>A.includes(Z)))
  return"npm-global";

However, the diagnostics code appears to be checking for a native installation configuration somewhere else, possibly in a cached state or different config location.

Additional Context

  • The warnings persist even after:
  1. Creating/updating ~/.claude/config.json
  2. Killing all Claude processes with pkill -f claude
  3. Clearing cache with rm -rf ~/.claude/.cache
  • The actual functionality of Claude Code works correctly despite these warnings
  • Config files checked:
  1. ~/.claude/config.json ✓ (set to npm-global)
  2. ~/.claude/settings.json✓ (contains only alwaysThinkingEnabled)
  3. ~/.claude/plugins/config.json ✓ (contains only repositories)

Workaround
Setting DISABLE_INSTALLATION_CHECKS=1 environment variable suppresses the warnings.

Suggested Fix
The diagnostics logic should respect the runtime-detected installation method (npm-global) and not compare it against a potentially stale or incorrectly initialized "native" configuration value. The detection logic in b$() appears correct, but the diagnostics validation logic may need to be updated to use the same detection method.

View original on GitHub ↗

13 Comments

github-actions[bot] · 11 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/7231
  2. https://github.com/anthropics/claude-code/issues/8415
  3. https://github.com/anthropics/claude-code/issues/5159

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

gbaian10 · 11 months ago

same issue

ant-kurt collaborator · 10 months ago

Have you previously installed the native executable?

Check ~/.claude.json or ~/.claude/.config.json (the path you listed ~/.claude/config.json is incorrect) for installMethod.

Philsmith1 · 10 months ago

Sorry yes you're right about the config path, below are the outputs from the suggested commands:

~/.claude.json:

json{
  "numStartups": 20,
  "installMethod": "native",
  "autoUpdates": false,
  ...
}

~/.claude/.config.json: Does not exist (confirmed with cat - file not found)
Other config files in ~/.claude/:

drwxr-xr-x   3 ***  staff     96  5 Oct 21:54 config
-rw-r--r--   1 ***  staff    100 30 Sep 20:32 config.json

Check for native installation:
No native installation found
I must have previously installed the native executable but have since removed it (worryingly don't remember doing this). The ~/.claude.json file still contains "installMethod": "native" from that previous installation.

Even though:

  • The native binary no longer exists at ~/.local/bin/claude
  • Claude Code is currently running from the npm-global installation at /usr/local/bin/claude
  • The runtime detection correctly identifies it as npm-global

...the diagnostics are reading the stale installMethod value from ~/.claude.json and showing warnings based on that outdated configuration.
Should I have to, as I have done now, manually update ~/.claude.json to set "installMethod": "npm-global"? Or should there be / is there a command that should have handled this cleanup when I switched installation methods?

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

madanyang · 8 months ago

The problem is still present , and just because the issue has been inacvite for x amount of days, it doesn't really help in solving the problem by sending a message via a bot, that no one actually reads.

Lucky8-GH · 8 months ago

打开 /Users/<username>/.claude.json 文件,删除 "installMethod": native, 然后保存文件
之后就不会再出现这个警告:installMethod is native, but claude command not found at /Users/<username>/.local/bin/claude

但是我不知道这个方法会造成什么其他的意外情况,请谨慎选择。

mmc41 · 8 months ago

Got the same problem

madanyang · 8 months ago

and now the automatic update is gone for some unknown reason

PaulRBerg · 7 months ago

Still happening and automatic updates no longer work, possibly because of this issue.

Current version: 2.1.12
Checking for updates to latest version...

Warning: Configuration mismatch
Config expects: npm-global installation
Currently running: unknown
Updating the unknown installation you are currently using
Config updated to reflect current installation method: unknown
Claude Code is up to date (2.1.12)

I am using fnm to manage Node.js on my machine. This is my npm config get prefix:

/Users/prb/Library/Application Support/fnm/node-versions/v25.2.1/installation

Maybe this is the problem? What Node.js version manager are you using @mmc41 @madanyang @Philsmith1

madanyang · 7 months ago

@PaulRBerg

Maybe this is the problem? What Node.js version manager are you using
npm version 
{
  npm: '11.6.2',
  node: '24.12.0',
  acorn: '8.15.0',
  ada: '3.3.0',
  amaro: '1.1.5',
  ares: '1.34.5',
  brotli: '1.2.0',
  cjs_module_lexer: '2.1.0',
  cldr: '48.0',
  icu: '78.1',
  llhttp: '9.3.0',
  modules: '137',
  napi: '10',
  nbytes: '0.1.1',
  ncrypto: '0.0.1',
  nghttp2: '1.67.1',
  openssl: '3.5.3',
  simdjson: '4.1.0',
  simdutf: '6.4.0',
  sqlite: '3.51.1',
  tz: '2025b',
  undici: '7.16.0',
  unicode: '17.0',
  uv: '1.51.0',
  uvwasi: '0.0.23',
  v8: '13.6.233.17-node.37',
  zlib: '1.3.1',
  zstd: '1.5.7'

cat /etc/os-release 
NAME="openSUSE Tumbleweed"
# VERSION="20260113"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20260113"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
# CPE 2.3 format, boo#1217921
CPE_NAME="cpe:2.3:o:opensuse:tumbleweed:20260113:*:*:*:*:*:*:*"
#CPE 2.2 format
#CPE_NAME="cpe:/o:opensuse:tumbleweed:20260113"
BUG_REPORT_URL="https://bugzilla.opensuse.org"
SUPPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed"
LOGO="distributor-logo-Tumbleweed"

``` shell
npm list -g
@anthropic-ai/claude-code@2.1.12

kuppit-at · 5 months ago

Same issue on Linux (CachyOS / Arch-based)

I'm experiencing the same npm prefix mismatch on Linux. Originally reported in #31772, closing it in favor of this issue.

Setup

| | |
|---|---|
| Claude Code | 2.1.70 |
| Node.js | v25.7.0 |
| npm | 11.11.0 |
| OS | CachyOS Linux (Arch-based) |
| Kernel | 6.19.6-2-cachyos |

Root Cause (same as described here)

claude binary:  /home/kuppit/.local/bin/claude
→ symlink to:   /home/kuppit/.local/lib/node_modules/@anthropic-ai/claude-code/cli.js

npm global prefix: /usr
→ npm i -g installs to: /usr/lib/node_modules/ (requires root)

Claude Code is installed user-locally under ~/.local/, but npm config get prefix returns /usr. The auto-updater calls npm i -g @anthropic-ai/claude-code which targets the wrong prefix — either failing due to missing permissions or updating a different (system-level) location.

Workaround

npm install -g --prefix ~/.local @anthropic-ai/claude-code

Suggestion

The auto-updater should resolve the actual installation path (e.g. by following the symlink of which claude) and use that prefix instead of relying on npm config get prefix.

madanyang · 5 months ago

fix npm config by creating a ~/,npmrc with

prefix="~/.local"

when using npm i -g everything will be installed to ~/.local/bin