Open Environment Variables:
Windows + R, type sysdm.cpl, press EnterClean User Variables:
E:\Apps\cursor\resources\app\binE:\AppData\Roaming\nvmClean System Variables:
Remove Individual Variables: Delete these variables if they exist (both User and System):
NVM_HOMENVM_SYMLINKshutdown /r /t 0After restart, check from Command Prompt:
echo %PATH%Ensure no E: drive development tool paths are listed.
# Run as Administrator
# Stop WSL
wsl --shutdown
# Remove all distributions
wsl --unregister Ubuntu
wsl --unregister Ubuntu-20.04
wsl --unregister Ubuntu-22.04
# Disable WSL features
dism.exe /online /disable-feature /featurename:Microsoft-Windows-Subsystem-Linux /norestart
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart
# Restart
shutdown /r /t 0After restart, run as Administrator:
# Re-enable WSL features
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# Restart again
shutdown /r /t 0After second restart:
# Set WSL2 as default
wsl --set-default-version 2
# Install Ubuntu
wsl --install -d UbuntuWhen Ubuntu starts:
sudo apt update && sudo apt upgrade -y# Create directory on target drive (example: E: drive)
mkdir E:\WSL\Ubuntu -Force# Stop WSL
wsl --shutdown
# Export Ubuntu to target drive
wsl --export Ubuntu E:\WSL\ubuntu-backup.tar
# CRITICAL: Verify export succeeded before proceeding!
dir E:\WSL\ubuntu-backup.tar⚠️ Only proceed if you see the tar file listed!
# Unregister current Ubuntu
wsl --unregister Ubuntu
# Import to new location
wsl --import Ubuntu E:\WSL\Ubuntu E:\WSL\ubuntu-backup.tar --version 2
# Set as default
wsl --set-default Ubuntu
# Verify import worked
wsl -l -v
# Clean up backup file
del E:\WSL\ubuntu-backup.tarAfter import, set your user as default:
# Replace 'yourusername' with your actual Ubuntu username
ubuntu config --default-user yourusername
# Test login
wsl# Create clean WSL configuration
sudo nano /etc/wsl.confAdd this content:
[interop]
appendWindowsPath = false# From Windows PowerShell
wsl --shutdown
wsl# Check PATH is clean (no Windows paths)
echo $PATH
# Should only show Linux paths like:
# /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin# Install Node.js from Ubuntu repository
sudo apt install -y nodejs npm
# Verify installation
node --version
npm --version
# Configure npm global directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc# Install Claude Code globally
npm install -g @anthropic-ai/claude-code
# Verify installation
claude --versionYou'll need one of these options:
Option A: Anthropic Console (API)
Option B: Claude Pro/Max Subscription
# Navigate to a test directory
mkdir ~/test-project
cd ~/test-project
# Start Claude Code
claudeFollow the authentication prompts to connect your account.
# Test basic commands
/help
# Test AI interaction
/ask "What is the current directory and what files are in it?"
# Test file generation
/generate "Create a simple hello.py file that prints 'Hello, Claude Code!'"
# Check system health
/doctor# List files created by Claude
ls -la
# Test file reading
/ask "Read the hello.py file and explain what it does"
# Test code execution (if Python installed)
python3 hello.py# Option 1: WSL project (best performance)
cd ~/my-existing-project
# Option 2: Windows project (accessible but slower)
cd /mnt/c/Users/YourUsername/Documents/my-project
# Option 3: Project on moved drive
cd /mnt/e/my-projects/existing-project# Start Claude Code in project directory
claude
# Generate project documentation
/generate "Create a comprehensive CLAUDE.md file that explains this project structure and how to work with it"
# Ask Claude to analyze the project
/ask "Analyze this codebase and give me a summary of what this project does"# Code analysis and review
/ask "Review the main.js file for potential improvements"
# Bug fixing
/ask "There's a bug in the login function, can you help me find and fix it?"
# Feature development
/generate "Add a new API endpoint for user profile management"
# Testing
/test "Create unit tests for the authentication module"
# Refactoring
/refactor "Convert this callback-based code to use async/await"
# Documentation
/ask "Generate JSDoc comments for all functions in utils.js"# Commit changes (if git is set up)
/ask "Review my changes and create an appropriate git commit message"
# Environment setup
/ask "Help me set up the development environment for this project"
# Dependencies
/ask "Analyze package.json and suggest any outdated or security-vulnerable dependencies"If you still see Windows PATH translation errors:
# Add to ~/.bashrc
echo 'export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/.npm-global/bin"' >> ~/.bashrc
source ~/.bashrc# Alternative Node.js installation via NodeSource
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs# Reset authentication
/logout
# Then restart claude and re-authenticate~/) rather than Windows mounts (/mnt/c/) for better performance/cost command in Claude CodeYou now have:
Claude Code is now ready to assist with your development workflow!