Videos
Step 1: Open cmd
Open cmd as administrator
Step 2: Set NPM configuration, telling npm to ignore executing scripts in packages during installation (e.g., preinstall, postinstall, etc.)
setx NPM_CONFIG_IGNORE_SCRIPTS true
$env:NPM_CONFIG_IGNORE_SCRIPTS = “true”
Step 3: Configure the SHELL environment variable
setx SHELL "C:\Program Files\Git\bin\bash.exe"
Step 4: Install Claude Code
npm install -g @anthropic-ai/claude-code
Step 5: Add to Environment Variables
Add this line to your environment variables:
C:\Users\y.xie\.npm-global
Step 6: Restart the development environment
Restart CMD or your IDE (e.g., VS Code, IntelliJ IDEA), then log in to your Claude Code account or configure the API directly within the application to start using it.
Supplementary Notes
Ensure Git for Windows is installed, with the path being
C:\Program Files\Git\bin\bash.exe.If the Git installation path is different, please adjust the SHELL environment variable path accordingly.
The path
C:\Users\y.xie\.npm-globalshould also be added based on your actual path.It is recommended to set these variables permanently to avoid having to reconfigure after each restart.
Later, if you want to uninstall and revert the changes from Step Two and Step Three, just execute
setx NPM_CONFIG_IGNORE_SCRIPTS falseandsetx SHELL "".
What a title. Anyways, figured I'd make a quick little guide on how to do this.
Prerequisites:
VS Code
Git repository (not an actual requirement, just how I did it with my limited bash knowledge)
Steps
1. Open up PowerShell and install WSL with:
cmd wsl --install
2. Set Ubuntu as default (important!):
cmd wsl --set-default Ubuntu
3. Open a WSL terminal
Tip: check the upper left dropdown menu in Windows Terminal that will show various terminals available
4. Install Claude Code in the WSL terminal (if you have issues, please refer to Anthropic's guide):
bash npx u/anthropic-ai/claude-code
5. Make a directory for your projects:
bash mkdir coolProjects && cd coolProjects
6. Clone your project (optional):
bash git clone https://github.com/yourrepo.git
7. Open VS Code
8. Install the official WSL extension
9. Press F1
10. Type "WSL"
IMPORTANT
11. Select "WSL: Connect to WSL using Distro"
Choose Ubuntu.
From here you can now open a folder within VS Code.
How do you know it worked? Check the bottom left corner of VS Code - it should say "WSL: Ubuntu" and your Claude Code extension should be enabled!
Troubleshooting
If you get Alpine Linux errors or "libstdc++ required" messages: This usually happens if you have Docker Desktop installed and it became your default WSL distribution instead of Ubuntu. Run wsl --list --verbose to check, and if docker-desktop-data has an asterisk (*), run wsl --set-default Ubuntu to fix it. That's why step 2 is so important!
Hope this is helpful!