Post

Complete Guide to Installing Claude Code on Windows — With Real-World Troubleshooting

Complete Guide to Installing Claude Code on Windows — With Real-World Troubleshooting
Prerequisites — Read these first
TL;DR — Key Takeaways
  • To install Claude Code on Windows 11, you need Node.js LTS, Git, and the Git Bash path environment variable — completable in 5 Quick Start steps
  • The most common post-install failures are not restarting the terminal (PATH not refreshed) and missing the CLAUDE_CODE_GIT_BASH_PATH environment variable
  • A single PowerShell diagnostic script can identify all environment issues at a glance
Visitors

Introduction

Claude Code is Anthropic’s CLI-based AI coding agent. While installation is relatively straightforward on macOS/Linux, on Windows you can get stuck at several stages including Git Bash path configuration, PowerShell execution policy, and PATH issues.

This guide documents the actual problems encountered and solutions when installing Claude Code in a Windows environment. Use the Quick Start for a fast install, or refer to the step-by-step detailed guide if issues arise.


1. Verified Environment

ItemVersion/Value
OSWindows 11 Home (10.0.26200)
Node.jsv24.12.0 (LTS)
npm11.6.2
Git2.51.0.windows.2
Claude Code@anthropic-ai/claude-code@2.1.63
Default ModelClaude Opus 4.6 (claude-opus-4-6)

Available Claude Models

ModelModel IDCharacteristics
Opus 4.6claude-opus-4-6Most powerful, suitable for complex tasks (default)
Sonnet 4.6claude-sonnet-4-6Fast responses, suitable for general tasks
Haiku 4.5claude-haiku-4-5-20251001Fastest, suitable for simple tasks

2. Quick Start (5 Steps)

If you already have Node.js and Git installed, you can install in just 5 steps below. If issues occur, refer to the Step-by-Step Detailed Guide.

Pre-Check

Open PowerShell and check your current status with the following commands:

1
2
3
4
node -v          # Version appears → Skip Node.js in Step 2
npm -v           # Version appears → npm is fine
git --version    # Version appears → Skip Git in Step 2
claude --version # Version appears → Already installed! Just check "Upgrade" section

Step 1. Set Execution Policy (One-Time)

1
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

Step 2. Install Required Programs

1
2
winget install -e --id OpenJS.NodeJS.LTS
winget install -e --id Git.Git

You must completely close and reopen the PowerShell terminal after installation. Opening a new terminal refreshes the PATH so that node and git commands are recognized.

Step 3. Set Git Bash Path Environment Variable (One-Time)

1
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH", "C:\Program Files\Git\bin\bash.exe", "User")

The last argument "User" is not your actual username. It’s a keyword indicating the scope of the Windows environment variable. Do not replace it with your username.

Step 4. Install Claude Code

1
2
3
4
5
# Method A: Official script (recommended)
irm https://claude.ai/install.ps1 | iex

# Method B: npm direct install (when Method A doesn't work)
npm install -g @anthropic-ai/claude-code

Step 5. Verify Installation

1
2
claude --version
# Example: 2.1.63 (Claude Code) ← Version number appearing means success!

3. Step-by-Step Detailed Guide

If you encountered issues with Quick Start, check the detailed troubleshooting for each step in this section.

3-1. PowerShell Execution Policy Setting

1
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

Verify the setting:

1
2
Get-ExecutionPolicy -List
# The CurrentUser entry should be RemoteSigned
PolicyDescriptionRecommended
RestrictedBlocks all scripts (Windows default) 
RemoteSignedAllows local scripts, requires signatures for remoteRecommended
UnrestrictedAllows all scriptsSecurity risk

Why is this needed? Windows blocks PowerShell script execution by default (Restricted). You need to change this policy to RemoteSigned to run the Claude Code installation script.


3-2. Node.js Installation

1
winget install -e --id OpenJS.NodeJS.LTS

Verify installation (in a new terminal):

1
2
node -v  # Example: v24.12.0
npm -v   # Example: 11.6.2

When winget Doesn’t Work

If winget is unavailable on older Windows versions, install manually:

  1. Visit https://nodejs.org/
  2. Download the LTS version
  3. Run the installer (.msi)
  4. Install with default options
  5. Open a new terminal

“Command not found” with node -v

Cause: Node.js path is not registered in PATH.

Resolution steps:

  1. Completely close and reopen the terminal
  2. If still not working, reboot the system
  3. If still not working, add PATH manually:
    • Start → Search “environment variables” → “User environment variables”
    • Edit Path → Add C:\Program Files\nodejs\

3-3. Git Installation

1
winget install -e --id Git.Git

Verify installation:

1
git --version  # Example: git version 2.51.0.windows.2

When winget Doesn’t Work

  1. Visit https://gitforwindows.org/
  2. Download and run the installer
  3. Keep default installation options (Git Bash is included)
  4. Open a new terminal

3-4. Git Bash Path Environment Variable Setting

Why is this needed? Claude Code internally uses a bash shell. On Windows it uses Git Bash, but sometimes it can’t find the path automatically, so you need to specify it manually.

1
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH", "C:\Program Files\Git\bin\bash.exe", "User")

Verify the setting (in a new terminal):

1
2
echo $env:CLAUDE_CODE_GIT_BASH_PATH
# Example: C:\Program Files\Git\bin\bash.exe

"User" parameter explanation

ValueMeaningNote
"User"Current logged-in user’s environment variableRecommended (use as-is)
"Machine"System-wide environment variableRequires administrator privileges
"Process"Valid only for current terminal sessionDisappears when terminal is closed

When Git is Installed in a Different Path

1
2
3
4
5
6
7
8
9
10
11
# Check Git installation location
where git
# Example: C:\Program Files\Git\cmd\git.exe
# → bash.exe is in the bin folder under the same Git directory

# Common Git Bash paths:
# C:\Program Files\Git\bin\bash.exe        ← 64-bit (most cases)
# C:\Program Files (x86)\Git\bin\bash.exe  ← 32-bit

# Set environment variable with confirmed path
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH", "actual_path", "User")

Using WSL (Alternative)

1
wsl --install  # Install WSL (one-time, reboot required)

While WSL also works, the Git Bash path setting is simpler, so the Git Bash method is recommended.


3-5. Claude Code Installation

1
irm https://claude.ai/install.ps1 | iex

When the above command doesn’t work:

1
2
3
4
5
# Variant 1: Execute as scriptblock
& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) latest

# Variant 2: Use CMD script
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Method B: npm Direct Install (When Method A Fails)

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

Pay attention to npm command syntax:

1
2
3
4
npm install -g package-name    # ✅ Correct syntax
npm i -g package-name          # ✅ Shorthand
npm --install package-name     # ❌ Wrong syntax
npm -install package-name      # ❌ Wrong syntax

3-6. Installation Verification and PATH Troubleshooting

1
2
claude --version
# Example: 2.1.63 (Claude Code)

When claude Command is Not Found

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 1. Close terminal and open a new one

# 2. Check npm global path
npm config get prefix
# Example: C:\Users\username\AppData\Roaming\npm

# 3. Check if that path is in PATH
echo $env:PATH

# 4. If not in PATH, add it ($env:USERPROFILE auto-completes user path)
[Environment]::SetEnvironmentVariable(
  "Path",
  [Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\AppData\Roaming\npm",
  "User"
)

# 5. Open new terminal and try again
claude --version

How to Check Your Windows Username

When you need to manually type your username in a path:

1
2
3
4
5
6
7
8
9
10
11
# Method 1: Full user profile folder path
echo $env:USERPROFILE
# Example: C:\Users\JohnDoe  ← "JohnDoe" is the username

# Method 2: Username only
echo $env:USERNAME
# Example: JohnDoe

# Method 3: whoami
whoami
# Example: DESKTOP-ABC123\JohnDoe  ← After "\" is the username

Using $env:USERPROFILE allows you to auto-complete the path without knowing the username, so use this variable instead of typing manually whenever possible.


4. Post-Installation Configuration

Configuration File Locations

FilePathPurpose
Global settings%USERPROFILE%\.claude\settings.jsonLanguage, status bar, etc.
Project settingsproject-folder\.claude\settings.local.jsonProject-specific permissions, etc.
Project contextproject-folder\CLAUDE.mdRules/instructions to pass to AI

Global Settings Example

%USERPROFILE%\.claude\settings.json:

1
2
3
4
5
6
7
{
  "statusLine": {
    "type": "command",
    "command": "bash ~/.claude/statusline-command.sh"
  },
  "language": "Korean"
}

The "language": "Korean" setting makes Claude Code respond in Korean.


5. Basic Claude Code Usage

Run Commands

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Start interactive session in project folder
cd C:\MyProject
claude

# One-line question (immediate answer without interactive session)
claude -p "Find bugs in this code"

# Pipe input
cat main.cpp | claude -p "Review this code"

# Run with specific model
claude --model claude-sonnet-4-6

# Continue previous conversation
claude --continue

# Resume most recent conversation
claude --resume

Slash Commands During Conversation

CommandDescription
/helpShow help
/modelCheck/change model
/compactCompress conversation context (useful for long conversations)
/clearReset conversation
/costCheck current session cost
/fastToggle Fast mode (same model, faster output)
/commitCreate Git commit for changes
/simplifyAuto-review and improve changed code
/batchParallel changes across large codebase

For detailed explanations of /simplify and /batch, refer to the Claude Memory Goes Free and /simplify, /batch post.


6. Upgrading

1
npm update -g @anthropic-ai/claude-code

Method B: Force Install Latest Version

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

Post-upgrade verification:

1
2
3
4
# Open a new terminal
claude --version

# Existing configuration files are automatically preserved.

7. Full Diagnostic Script

When you don’t know where the issue is, paste this script into PowerShell to diagnose the entire environment at once.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Write-Host "=== Claude Code Environment Diagnostic ===" -ForegroundColor Cyan

Write-Host "`n[Node.js]" -ForegroundColor Yellow
try { node -v } catch { Write-Host "  ❌ Not installed" -ForegroundColor Red }

Write-Host "`n[npm]" -ForegroundColor Yellow
try { npm -v } catch { Write-Host "  ❌ Not installed" -ForegroundColor Red }

Write-Host "`n[Git]" -ForegroundColor Yellow
try { git --version } catch { Write-Host "  ❌ Not installed" -ForegroundColor Red }

Write-Host "`n[Git Bash Path]" -ForegroundColor Yellow
$gitBash = [Environment]::GetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH", "User")
if ($gitBash) { Write-Host "  $gitBash" } else { Write-Host "  ❌ Not configured" -ForegroundColor Red }

Write-Host "`n[Execution Policy]" -ForegroundColor Yellow
Get-ExecutionPolicy -Scope CurrentUser

Write-Host "`n[Claude Code]" -ForegroundColor Yellow
try { claude --version } catch { Write-Host "  ❌ Not installed" -ForegroundColor Red }

Write-Host "`n[npm Global Path]" -ForegroundColor Yellow
npm config get prefix

Example output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
=== Claude Code Environment Diagnostic ===

[Node.js]
v24.12.0

[npm]
11.6.2

[Git]
git version 2.51.0.windows.2

[Git Bash Path]
  C:\Program Files\Git\bin\bash.exe

[Execution Policy]
RemoteSigned

[Claude Code]
2.1.63 (Claude Code)

[npm Global Path]
C:\Users\username\AppData\Roaming\npm

If all items are normal, installation is complete. If you see a red , refer to the troubleshooting section for that item.


8. Troubleshooting Summary

SymptomCauseResolution
node -v doesn’t workNode.js not installed or PATH not registered3-2. Node.js Installation
irm ... \| iex blockedExecution policy is Restricted3-1. Execution Policy Setting
npm --install errorWrong npm syntaxUse npm install -g
Shell error running claudeGit Bash path not set3-4. Git Bash Path Setting
claude command not foundnpm global path not registered3-6. PATH Troubleshooting
Nothing worksTerminal not restartedClose and reopen terminal

File Path Summary

ItemPath
Claude executable%USERPROFILE%\AppData\Roaming\npm\claude.cmd
npm global packages%USERPROFILE%\AppData\Roaming\npm\
Claude global settings%USERPROFILE%\.claude\settings.json
Claude project settingsproject\.claude\settings.local.json
Git BashC:\Program Files\Git\bin\bash.exe

Conclusion

The three most common blockers when installing Claude Code on Windows:

  1. Not restarting the terminal — PATH doesn’t refresh, so installed programs aren’t recognized
  2. CLAUDE_CODE_GIT_BASH_PATH not set — Claude Code can’t find bash and fails to run
  3. "User" parameter confusion — Mistaking the environment variable Scope keyword for your actual username

If you watch out for these three things, you can resolve most installation issues. When problems occur, run the Diagnostic Script first.


References

This post is licensed under CC BY 4.0 by the author.