Skip to content

Set Up Claude Code on Windows With WSL (Step-by-Step)

Install and run Claude Code on Windows using WSL. Node setup, install, connecting a cheap model, persisting env vars, and the WSL-specific gotchas to avoid.

MGMCSA Guru Team August 3, 2026 3 min read
Installing and running Claude Code inside WSL on Windows

On Windows, the smoothest way to run Claude Code is inside WSL. It’s a Node tool built around a Unix-like shell, so WSL gives it the environment it expects — predictable variables, clean paths, and proxies that behave. This guide gets Claude Code installed and running in WSL, including pointing it at a cheaper model, with the WSL-specific details that trip people up.

If WSL isn’t installed yet, start with the WSL install guide.

Step 1: Node in WSL

Claude Code is an npm package, so install Node inside the Linux environment. nvm is the cleanest way:

sudo apt update && sudo apt install -y curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# reopen the shell, then:
nvm install --lts
node -v

Step 2: Install Claude Code

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

Step 3: Run it (with Anthropic or a cheap model)

With an Anthropic account, just run claude and sign in. To run on a cheaper model, set the endpoint variables in your shell profile so they persist:

echo 'export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"' >> ~/.bashrc
echo 'export ANTHROPIC_AUTH_TOKEN="sk-your-key"' >> ~/.bashrc
echo 'export ANTHROPIC_MODEL="deepseek-chat"' >> ~/.bashrc
source ~/.bashrc
claude

This points Claude Code at DeepSeek; swap the URL/model for GLM or Kimi. For OpenAI-only providers, use Claude Code Router.

Step 4: Work in the Linux file system

Claude Code reads and writes a lot of files; that’s faster in your Linux home than across /mnt/c. For heavy sessions, copy the project in:

cp -r /mnt/c/Users/YourName/myproject ~/myproject
cd ~/myproject
claude

More on the file bridge in access your Windows files from WSL.

Claude Code in WSL essentials

nvm install --lts Get Node inside WSL
npm i -g @anthropic-ai/claude-code Install Claude Code
ANTHROPIC_BASE_URL in ~/.bashrc Point at a cheap model (optional)
cp project into ~ Speed up file-heavy work
claude Launch the agent

WSL gotchas

  • Global binaries missing — reopen the shell after the npm install so PATH updates.
  • Variables don’t stick — add them to ~/.bashrc and source it; setting them inline only lasts the session.
  • Slow on big repos — move the project into your Linux home.
  • Browser auth — sign-in flows open your Windows browser from WSL; if not, copy the URL across.

Claude Code on WSL checklist

  • WSL installed; Node via nvm inside WSL
  • Claude Code installed globally with npm
  • Optional: cheap-model env vars in ~/.bashrc
  • Active project copied into Linux home
  • Launched with claude and tested

Wrapping up

Running Claude Code on Windows is cleanest in WSL: install Node with nvm, add Claude Code via npm, and optionally point it at a cheap model with ANTHROPIC_* variables in ~/.bashrc. Keep active projects in your Linux home for speed, and reopen the shell after installs so the binary is on PATH.

From here, connect a backend — DeepSeek, GLM, or via Claude Code Router on WSL.

Frequently asked questions

Should I run Claude Code in WSL or native Windows?

WSL is the smoother choice. Claude Code is a Node tool that assumes a Unix-like shell, so WSL gives predictable environment variables, paths, and proxy behavior. Native Windows works but you'll hit more PATH and quoting quirks.

Do I need a separate Node install in WSL?

Yes. WSL has its own Linux toolchain, so install Node inside WSL (via nvm) and install Claude Code there with npm. The Windows Node install doesn't carry into the Linux environment.

Where should my project files live?

In your Linux home for heavy work — agent file operations are faster there than across the /mnt/c boundary. You can work under /mnt/c for casual tasks, but copy active projects into ~ for speed.

How do I run Claude Code on a cheap model in WSL?

Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in your shell profile to a compatible provider like DeepSeek or GLM. Then claude routes there in every WSL shell. See the per-model guides for exact endpoints.

Why does my Windows Node version not work?

Because WSL is a separate Linux environment. Calling the Windows node.exe from WSL causes path and permission issues. Install Node inside WSL so npm's global binaries live in your Linux home.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.