[BUG] claude CLI Not Recognized After Global Installation on Windows
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
- Run npm install -g @anthropic-ai/claude-code
- Verify that the global npm path is added to the system PATH variable (in my case: C:\Users\<username>\AppData\Roaming\npm)
- Open a new PowerShell terminal
- 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" />
16 Comments
Same issue for me on Mac - Sequoia 15.5 (24F74).
In the end I just added the following alias to my
~/.zshrcfile (someone could do the same for their.bashrcfile, etc)```bash
alias claude="npx claude"
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.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" />
Sorry, I didn't see that you have added the npm global path to the environment variable. Excuse me, ignore my previous answer
I found I just need to add %AppData%\npm to sytem env PATH, this fixed it for me on windows 11.
ok @pascalandr will check it
Same Problem but with nvm. Does anyone have an idea about a possible solution?
@prototowb have you tried my given solution?
I found the solution:
that's it:D
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.
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.
the current fix is noted in the install text, you need to add
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.
@agstevens Thanks for pointing this out.
You'll want to
where.exe claudeto see if PATH is set up properly, and set the PATH as mentioned above if not.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.