[BUG] claude CLI Not Recognized After Global Installation on Windows

Resolved 💬 16 comments Opened Jul 17, 2025 by Shahzaibdev355 Closed Aug 22, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • Anthropic API
  • Claude CLI version: 1.0.53 (Claude Code)
  • Operating System: Windows 11
  • Terminal: PowerShell

Bug Description

The documentation says that after installing the Claude CLI globally via:
npm install -g @anthropic-ai/claude-code

I should be able to run the CLI using the Claude command from anywhere.

However, the command Claude is not recognized in my terminal, even though the package is globally installed and the global npm path is added to my environment PATH.

Steps to Reproduce

  1. Run npm install -g @anthropic-ai/claude-code
  2. Verify that the global npm path is added to the system PATH variable (in my case: C:\Users\<username>\AppData\Roaming\npm)
  3. Open a new PowerShell terminal
  4. Run the claude command

Observe error:

claude : The term 'claude' is not recognized as the name of a cmdlet, function, script file, or operable program.

Expected Behavior

After installing globally, the claude command should be available as a global binary and executable from anywhere.

Actual Behavior

Running claude results in a “command not recognized” error, despite a successful global installation.

The only working alternative is this, if I run this, then Claude CLI works:

npx @anthropic-ai/claude-code

Additional Context

  • Other globally installed packages like firebase-tools and vercel work fine from the terminal.
  • This seems to be an issue either with the bin field in the package.json of the CLI, or a missing link/binary in the published package.

Execution Images:

Error when running claude:

<img width="1622" height="591" alt="Image" src="https://github.com/user-attachments/assets/acee7077-acac-48ea-86e4-5bcbbac26d21" />

<img width="1668" height="417" alt="Image" src="https://github.com/user-attachments/assets/97ea03d0-c7d0-49a4-86e9-3fef7513fa94" />

npx command works:

<img width="1596" height="691" alt="Image" src="https://github.com/user-attachments/assets/56bf9d93-b78f-4603-acc4-5ef2b5d40dad" />

View original on GitHub ↗

16 Comments

joekrump · 12 months ago

Same issue for me on Mac - Sequoia 15.5 (24F74).

In the end I just added the following alias to my ~/.zshrc file (someone could do the same for their .bashrc file, etc)

```bash
alias claude="npx claude"

leependu · 12 months ago

Same issue here, also Windows 11 and PowerShell (Core, pwsh). I've also tried installing Claude Code to my home folder ((cd ~) && (npm install @anthropic-ai/claude-code)), same results.

liujianjie · 11 months ago

I also encountered this problem, I asked AI and tried the methods it provided to solve it.
I set the global storage location for npm elsewhere, just add this path to the environment variables.

<img width="1211" height="695" alt="Image" src="https://github.com/user-attachments/assets/596979db-e21c-42db-9f90-ed7a50887116" />

liujianjie · 11 months ago

Sorry, I didn't see that you have added the npm global path to the environment variable. Excuse me, ignore my previous answer

pascalandr · 11 months ago

I found I just need to add %AppData%\npm to sytem env PATH, this fixed it for me on windows 11.

Shahzaibdev355 · 11 months ago

ok @pascalandr will check it

prototowb · 11 months ago

Same Problem but with nvm. Does anyone have an idea about a possible solution?

Shahzaibdev355 · 11 months ago

@prototowb have you tried my given solution?

jaberjaber23 · 11 months ago

I found the solution:

  1. npm uninstall -g claude (remove wrong package)
  2. npm install -g @anthropic-ai/claude-code (install correct one)
  3. claude setup-token`(get your token)
  4. [Environment]::SetEnvironmentVariable("CLAUDE_CODE_OAUTH_TOKEN", "your-token-here", "User") (set token)

that's it:D

Shahzaibdev355 · 11 months ago

Thanks for sharing the solution. @jaberjaber23 , if this resolves the issue for others as well, kindly confirm so it can help validate the fix for the community.

jacobhallgren · 11 months ago

Since I don't use token based usage of cluade this solved it for me

npm uninstall -g @anthropic-ai/claude-code
irm https://claude.ai/install.ps1 | iex

prototowb · 11 months ago
Since I don't use token based usage of cluade this solved it for me npm uninstall -g @anthropic-ai/claude-code irm https://claude.ai/install.ps1 | iex

this solved it for me (Win11, PowerShell 7.5.2, NVM) - script serves a native install, currently in beta, check https://docs.anthropic.com/en/docs/claude-code/quickstart

BUT - this only fixed the issue for usage with Git Bash. In PowerShel the "Claude Code CLI not found in PATH" persists.

agstevens · 11 months ago

the current fix is noted in the install text, you need to add

C:\Users\%USERPROFILE%\.local\bin

to your
System Properties>Environment Variables>Path
path and restart the terminal.

It's nice they put that note in the installation script output, but it took me a second to notice it, and I ended up on this thread first, so sharing for the others who also missed it on the output.

Shahzaibdev355 · 11 months ago

@agstevens Thanks for pointing this out.

ant-kurt collaborator · 10 months ago

You'll want to where.exe claude to see if PATH is set up properly, and set the PATH as mentioned above if not.

github-actions[bot] · 10 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.