Skip to content

Claude Code on WSL - Installation Guide

Requirements

  • Windows 10+ with WSL 1 or WSL 2
  • 4GB RAM minimum (for basic perfomance, use 16GB for optimal use)
  • Node.js 18+
  • Internet connection

Step 1: Install Node.js in WSL

Check if you already have Node.js:

node --version  # Should be v18+
which node      # Must NOT be /mnt/c/... (Windows path)

If Node.js is missing or points to Windows, install it:

Ubuntu/Debian:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs

Verify:

which node  # Should be /usr/bin/node (Linux path)
which npm   # Should be /usr/bin/npm (Linux path)


Step 2: Configure npm for Linux

npm config set os linux

Step 3: Install Claude Code

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

Important: Do NOT use sudo

If installation fails:

npm install -g @anthropic-ai/claude-code --force --no-os-check


Step 4: Verify Installation

claude doctor

Step 5: Launch Claude Code

claude

Follow the authentication prompts to log in.


Troubleshooting

Issue: PATH Conflicts (Windows Node.js detected)

Symptom: which node shows /mnt/c/Program Files/...

Fix: Prepend Linux paths in ~/.bashrc:

echo 'export PATH="/usr/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Issue: Permission Errors

Never use sudo with npm global installs.

Fix: Configure npm user directory:

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Reinstall:

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

Issue: JetBrains IDE Not Detected (WSL2 only)

Symptom: IDE on Windows not detected by Claude Code in WSL2

Quick fix: Use native Windows install instead:

# Run in PowerShell (Windows side)
irm https://claude.ai/install.ps1 | iex

Advanced fix: Configure mirrored networking in C:\Users\YourUsername\.wslconfig:

[wsl2]
networkingMode=mirrored

Restart WSL from PowerShell:

wsl --shutdown


Updates

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

Quick Reference

claude           # Start session
claude doctor    # Check installation
/help            # In-session help

Alternative: Native Windows installer (bypasses all WSL/npm issues):

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