Installing Claude Code on Windows
This lesson covers Claude Code installation on Windows using PowerShell, with notes on the recommended WSL2 approach for full feature support.
Option 1: Windows with PowerShell (Quick Start)
Step 1 — Install Node.js:
Download the Windows installer from nodejs.org (LTS version), or use winget:
winget install OpenJS.NodeJS.LTS
Restart PowerShell, then verify:
node --version
npm --version
Step 2 — Install Claude Code:
npm install -g @anthropic-ai/claude-code
Step 3 — Authenticate:
claude
# Follow the browser login prompt
Or set the API key:
$env:ANTHROPIC_API_KEY = "sk-ant-xxxxx"
claude
To persist the API key, add it to your PowerShell profile:
notepad $PROFILE
# Add this line:
# $env:ANTHROPIC_API_KEY = "sk-ant-xxxxx"
Option 2: WSL2 (Recommended for Full Support)
WSL2 (Windows Subsystem for Linux) provides the best experience because Claude Code was designed for Unix-like environments. Many shell commands, scripts, and tooling work seamlessly on WSL2.
Step 1 — Install WSL2:
wsl --install
# Restart your computer
# Set up your Ubuntu username and password
Step 2 — Inside WSL2, install Node.js:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
nvm install 20
Step 3 — Install Claude Code:
npm install -g @anthropic-ai/claude-code
claude --version
From here, follow the same authentication steps as the macOS lesson.
PowerShell vs WSL2 Comparison
| Feature | PowerShell | WSL2 |
|---|---|---|
| Installation complexity | Simple | Moderate |
| Bash command support | Limited | Full |
| Git integration | Good | Excellent |
| Docker support | Through Docker Desktop | Native |
| File system performance | Native | Near-native |
| Claude Code compatibility | Good | Excellent |
Accessing Your Windows Files from WSL2
Your Windows drives are mounted under /mnt/:
cd /mnt/c/Users/YourName/Projects
For better performance, store projects inside the WSL2 file system:
mkdir ~/projects && cd ~/projects
Common Windows Issues
Execution policy errors in PowerShell:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
"EACCES" permission errors: Run PowerShell as Administrator for the initial global install only.
WSL2 network issues: If Claude Code cannot reach the API, check that your DNS is configured correctly in WSL2. Create or edit /etc/resolv.conf with nameserver 8.8.8.8.
Key Takeaways
- PowerShell works for basic Claude Code usage — quick to set up
- WSL2 is the recommended approach for full compatibility with all shell commands
- Install with
npm install -g @anthropic-ai/claude-codeon either platform - Store projects inside the WSL2 file system for best performance when using WSL2
- Use
wsl --installto get started with WSL2 — it installs Ubuntu by default