‘claude’ Is Not Recognized as an Internal or External Command — Here’s Exactly How to Fix It

You installed Claude. You opened your terminal. And then this happened:

C:\Users\YourName>

claude

‘claude’ is not recognized as an internal or external command,
operable program or batch file.

'claude' Is Not Recognized as an Internal or External Command — Here's Exactly How to Fix It

If you just installed Claude Code (Anthropic’s CLI tool) and got hit with this error the moment you typed claude in your terminal — don’t worry. Your installation probably worked fine. This error almost always means one thing: your system doesn’t know where to find the Claude executable.

This guide will explain exactly why it happens and walk you through every fix, step by step, for Windows, Mac, and Linux.

⚠️

Before you start:This error is about your system PATH — not the Claude app itself. You don’t need to reinstall Claude. In most cases, a single PATH fix resolves it permanently.

What Does This Error Actually Mean?

When you type any command in a terminal — claudenodenpm — your operating system searches through a list of folders called the PATH to find the matching program. If it can’t find it in any of those folders, it throws this error.

This error is not saying Claude is broken or missing. It’s saying your terminal doesn’t know which folder Claude was installed into — so it can’t run it.

Think of it like a library. The book is there. But if the librarian doesn’t have it in the catalogue, they’ll tell you it doesn’t exist — even though it’s sitting on a shelf somewhere.

💡

Most common cause:Claude Code is installed via npm globally, but npm’s global binary folder is not added to your system’s PATH. This is extremely common on fresh Windows setups and on Mac/Linux machines that haven’t configured their shell profile correctly.

Step 1 — Confirm Claude Is Actually Installed

Before fixing the PATH, confirm whether Claude is installed at all. Open your terminal and run:

Terminalbash

npm list -g claude
# or check for the package directly
npm list -g @anthropic-ai/claude-code

If you see the package listed, Claude is installed — and this is purely a PATH issue. Move to Step 2. If the output says empty, install Claude first:

Install Claude Codebash

npm install -g @anthropic-ai/claude-code

Once installed, if the error persists, continue below.

Step 2 — Find Where npm Installs Global Binaries

Run this command to find exactly where npm puts its global executables:

Terminal — all platformsbash

npm config get prefix

This will return a path like:

Example outputoutput

# Windows
C:\Users\YourName\AppData\Roaming\npm

# Mac / Linux
/usr/local
# binaries are in: /usr/local/bin

Copy this path. You will need it in the next step.

Step 3 — Fix the PATH (Pick Your OS)

Windows — Add npm to System PATH

Press Win + S, search for “Environment Variables” and open “Edit the system environment variables.”

Click Environment Variables → under System variables, find Path → click Edit.

Click New and paste the path you got from npm config get prefix. On most Windows machines this is:

Add this to Windows PATHpath

C:\Users\YourName\AppData\Roaming\npm

Click OK on all dialogs. Close and reopen your terminal completely — not just a new tab. Then test:

Test itcmd

claude –version
# Expected: Claude Code version x.x.x

Mac and Linux — Add to Shell Profile

On Mac and Linux, you need to add the npm binary path to your shell’s profile file. First check which shell you’re using:

Check your shellbash

echo $SHELL
# Returns: /bin/zsh (Mac default) or /bin/bash (Linux default)

Then open the correct profile file and add the PATH export:

For zsh (Mac default — .zshrc)bash

echo ‘export PATH=”$PATH:$(npm config get prefix)/bin”‘ >> ~/.zshrc
source ~/.zshrc

For bash (Linux / older Mac — .bashrc)bash

echo ‘export PATH=”$PATH:$(npm config get prefix)/bin”‘ >> ~/.bashrc
source ~/.bashrc

Then test:

Verifybash

claude –version
# Should return version number — error is gone ✓

Alternative Fixes If PATH Didn’t Work

Use Node Version Manager (nvm) Instead of System Node

If you installed Node.js directly (not via nvm), global npm packages sometimes end up in protected system folders that don’t play nicely with PATH. Installing nvm and switching to an nvm-managed Node version resolves this cleanly.

Install nvm (Mac/Linux)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install –lts
nvm use –lts
npm install -g @anthropic-ai/claude-code

Run Claude With Full Path (Temporary Workaround)

If you need to use Claude right now while fixing PATH, you can call it using its full path directly:

Windows

%APPDATA%\npm\claude

Mac / Linux

$(npm config get prefix)/bin/claude

Reinstall Node.js and npm From Official Source

If you installed Node.js from an unofficial source or an old version, global packages may not be configured correctly. Download the latest LTS version directly from nodejs.org, reinstall, then reinstall Claude Code via npm. This resets all global binary paths cleanly.

Restart Your Terminal (Or Your Entire Computer)

PATH changes don’t apply to already-open terminal sessions. After any fix, always fully close and reopen your terminal. On Windows, sometimes a full system restart is needed for environment variable changes to propagate correctly across all apps.

Quick Diagnosis — What’s Your Situation?

SituationLikely CauseBest Fix
Error right after fresh installnpm global bin not in PATHStep 3 — add PATH for your OS
Works in one terminal, not anotherProfile file not sourced in that shellRun source ~/.zshrc or source ~/.bashrc
npm itself not foundNode.js not installed or brokenReinstall Node from nodejs.org
Error even after PATH fixnvm conflict or permissions issueFix A — switch to nvm-managed Node
Need Claude running right nowPATH not propagated yetFix B — run via full executable path

Fastest fix for most people:Run npm config get prefix, copy the output, add it to your system PATH, close and reopen your terminal. That’s it — Claude will work.

Verify Everything Is Working

Once fixed, run these three commands to confirm your entire Claude setup is healthy:

Full verification checkbash

# 1. Check Claude is found
which claude  # Mac/Linux — should return a path
where claude  # Windows — should return a path

# 2. Check version
claude –version

# 3. Start Claude
claude
# Should open the Claude Code interface ✓

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *