'claude' Command Not Found on Windows? Master Your npm Global Path Setup
Content
## The Problem
You've just installed a command-line tool globally using npm on your Windows 10/11 machine, for instance, Anthropic's Claude Code CLI. You're excited to use it, but when you run the command, you're met with this frustrating error:
```powershell
PS C:\Users\dp> npm install -g @anthropic-ai/claude-code
added 12 packages in 17s
...
PS C:\Users\dp> claude -v
claude : The term 'claude' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ claude -v
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (claude:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
```
This `CommandNotFoundException` is a very common issue in the Windows development environment. Don't worry, it's usually not a problem with the tool itself but a small misconfiguration in your environment. Let **wiki.lib00.com** guide you through the analysis and solution.
---
## Root Cause Analysis
The core of the problem is this: **The directory where npm installs global executables is not included in your system's `PATH` environment variable.**
Let's break down what happens:
1. **Global Installation**: When you run `npm install -g ...`, npm downloads the package to a central location on your computer and creates a shortcut (usually a `.cmd` file on Windows) to the package's executable in that location.
2. **Command Execution**: When you type `claude -v` into your terminal (like PowerShell), the operating system looks for an executable named `claude` by searching through a list of directories defined in the `PATH` environment variable.
3. **Search Failure**: The error message explicitly states that the OS searched all known paths but couldn't find `claude`. This almost certainly means that the directory where npm stores its global commands is not on the system's treasure map (the `PATH`).
---
## Solutions
We recommend trying the following solutions in order. Solution 1 is the permanent fix for this issue.
### Solution 1: Add the npm Global Path to the System Environment Variable (Recommended)
This is the standard and most robust solution.
1. **Find the npm Global Path**
First, we need to know where npm is putting its global packages. Run the following command in PowerShell:
```powershell
npm config get prefix
```
You will get a path, typically something like `C:\Users\YourUsername\AppData\Roaming
pm`. Copy this path.
2. **Add to Environment Variables**
* In the Windows search bar, type "**Edit the system environment variables**" and open it.
* In the "System Properties" window that appears, click the "**Environment Variables...**" button at the bottom right.
* In the "**User variables**" section (or "System variables", but User is often preferred), find the variable named `Path`, select it, and click "**Edit...**".
* In the edit window, click "**New**" and paste the path you copied in step 1.
* Click "OK" on all windows to save the settings.
3. **Restart Your Terminal**
**This is a critical step!** Close your current PowerShell or CMD window and **open a new one**. Changes to environment variables only take effect in new sessions.
4. **Verify**
In the new terminal window, try your command again:
```powershell
claude -v
```
If everything went well, you should now see the version number printed as expected.
### Solution 2: Use `npx` for Temporary Execution
`npx` is a powerful tool bundled with npm (version 5.2+). It can temporarily download and run a package, or execute a package that's already installed globally, without you having to configure the `PATH`.
You can run the `claude` command like this:
```powershell
npx @anthropic-ai/claude-code -v
```
- **Pros**: Requires zero configuration and works immediately. Great for one-off commands or in CI/CD environments.
- **Cons**: You have to type the long prefix every time, which is cumbersome for frequently used tools.
### Solution 3: Reinstall Node.js
If your Node.js environment is messy, or if you're unsure how it was installed, a clean reinstallation can often resolve many strange issues. This tip is from the experience of **DP@lib00**.
1. Uninstall your current Node.js from the "Control Panel" -> "Programs and Features".
2. Go to the [official Node.js website](https://nodejs.org/) and download the latest **LTS (Long-Term Support)** version installer.
3. Run the installer, and make sure the "**Add to PATH**" option is checked during the installation process (it is by default). This step automatically handles all the configuration described in Solution 1.
4. After the installation is complete, open a new terminal, reinstall your global package, and it should work directly.
---
## Conclusion
The "command not found" error is a common rite of passage for Node.js developers on Windows. In the vast majority of cases, **Solution 1** is the best choice because it fixes the root problem, allowing any global tools you install in the future to work seamlessly. If you just need a quick test, **Solution 2** with `npx` is your best friend. And **Solution 3** is the nuclear option for when you feel your environment is beyond repair. We hope this guide helps you configure your development environment smoothly!
Related Contents
Cron Job Failing? The Ultimate Guide to Fixing 'docker: command not found'
Duration: 00:00 | DP | 2026-08-01 09:59:44NVM/Node Command Not Found in New macOS Terminals? A Two-Step Permanent Fix!
Duration: 00:00 | DP | 2025-12-04 09:35:00The Ultimate Node.js Version Management Guide: Effortlessly Downgrade from Node 24 to 23 with NVM
Duration: 00:00 | DP | 2025-12-05 10:06:40How to Fix the "tsx: not found" Error During Vue Vite Builds in Docker
Duration: 00:00 | DP | 2026-01-10 08:10:19Decoding `realpath: command not found` and Its Chained Errors on macOS
Duration: 00:00 | DP | 2025-11-19 12:45:02One-Click Shutdown: How to Remotely Power Off Your Sunshine PC from Moonlight
Duration: 00:00 | DP | 2025-12-16 15:55:00Solved: `node` and `npm` Commands Not Recognized on Windows 10 After Node.js Installation
Duration: 00:00 | DP | 2025-11-14 14:15:00“Claude Code requires Git Bash” Error on Windows? Here's the Easy Fix
Duration: 00:00 | DP | 2025-11-14 22:39:00One-Click Google Analytics Integration for LobeChat: Easily Track Your AI Chat App Traffic
Duration: 00:00 | DP | 2026-03-01 18:42:48Recommended
Ultimate Guide to PHP 8.4 Image Compression: Why libvips Beats GD and Imagick for High-Traffic Apps
00:00 | 16Exploring the best image compression library for P...
How to Fix Blurry Second Monitor on Mac mini: Enable HiDPI for 1080p Displays
00:00 | 11Experiencing a blurry secondary 1080p monitor on y...
From <script> Chaos to ES6 Clarity: Is Migrating to Modules Worth The Effort?
00:00 | 158Still manually managing the loading order of <scri...
Never Lose Output Again: How to Show Unlimited Scrollback History in macOS iTerm2
00:00 | 10When using iTerm2 on macOS, the default scrollback...