Troubleshooting
Solutions for the most common issues when running Claude Code on Windows.
Node.js and npm Issues
"node is not recognized as an internal or external command"
Cause: Node.js is not in your system PATH.
Fix:
- Reinstall Node.js from nodejs.org — choose the LTS version
- During installation, make sure "Add to PATH" is checked
- Close and reopen your terminal after installation
- Verify with:
node --version
"npm is not recognized"
Cause: npm was not installed with Node.js, or PATH is not set.
Fix:
- Reinstall Node.js (npm comes bundled with it)
- If npm is installed but not found, add it to PATH manually:
- Search "Environment Variables" in Windows Start menu
- Edit the
Pathvariable under "User variables" - Add:
C:\Users\<YourUsername>\AppData\Roaming\npm
- Restart your terminal
Wrong Node.js version
Cause: Claude Code requires Node.js 18 or later.
Fix:
- Check your version:
node --version - If below v18, download the latest LTS from nodejs.org
- Uninstall the old version first via Windows Settings > Apps
Claude Code Installation Issues
"claude is not recognized"
Cause: The global npm bin directory is not in your PATH.
Fix:
- Find your npm global prefix:
npm prefix -g - Add that path (with
\binappended) to your PATH environment variable - Restart your terminal
- Verify:
claude --version
Installation fails with permission errors
Cause: npm does not have permission to write to the global directory.
Fix:
- Run PowerShell as Administrator (right-click > "Run as Administrator")
- Run:
npm install -g @anthropic-ai/claude-code - For a non-admin fix, configure npm to use a user-local directory:
Then add
npm config set prefix "$env:USERPROFILE\.npm-global"%USERPROFILE%\.npm-global\binto your PATH.
PowerShell Issues
"Execution of scripts is disabled on this system"
Cause: PowerShell's execution policy blocks scripts.
Fix:
- Open PowerShell as Administrator
- Run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser - Type
Yto confirm - Close and reopen PowerShell
PowerShell version is too old
Cause: Windows ships with PowerShell 5.1, but some features work better with PowerShell 7+.
Fix:
- Install PowerShell 7:
winget install Microsoft.PowerShell - Or download from github.com/PowerShell/PowerShell
- Launch with
pwshinstead ofpowershell
Authentication Issues
"Invalid API key"
Cause: Your API key is incorrect, expired, or not set.
Fix:
- Check your API key at console.anthropic.com
- Re-run
claudeand follow the authentication prompts - If using an environment variable, verify it is set correctly:
echo $env:ANTHROPIC_API_KEY
"Rate limit exceeded"
Cause: You have sent too many requests in a short time.
Fix:
- Wait a few minutes and try again
- Use
/compactto reduce the size of your next request - Check your usage at console.anthropic.com
Permission and File Issues
Claude cannot read/write files
Cause: The file or directory permissions prevent access.
Fix:
- Make sure you are running Claude Code from within your project directory
- Check that the files are not read-only: right-click > Properties > uncheck "Read-only"
- Avoid running Claude Code in system-protected directories (like
C:\Windows\orC:\Program Files\)
Long file paths cause errors
Cause: Windows has a 260-character path limit by default.
Fix:
- Enable long paths in Windows:
- Open Registry Editor (
regedit) - Navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem - Set
LongPathsEnabledto1
- Open Registry Editor (
- Or enable via Group Policy: Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths
MCP Server Issues
MCP server fails to start
Cause: The server package is not installed or the command is wrong.
Fix:
- Verify the package exists:
npx <package-name> --help - Check your
settings.jsonfor typos in the server configuration - Review MCP logs: Claude Code stores MCP connection logs that can reveal the error
MCP server connects but tools are missing
Cause: The server started but did not register its tools correctly.
Fix:
- Restart Claude Code (exit and re-enter)
- Check that the server version supports the tools you expect
- Verify the server configuration includes all required arguments
General Tips
- Always restart your terminal after changing PATH or environment variables
- Run
claude doctor(if available) to diagnose common configuration issues - Check the version:
claude --version— make sure you are on the latest version - Update Claude Code:
npm update -g @anthropic-ai/claude-code - Check disk space: Claude Code needs space for temporary files and caches