データサイエンス ~戦略コンサルの現場から~

データサイエンティスト。データサイエンスを活用し、経営戦略やマーケティング戦略、M&A戦略の策定を行っております。

Complete Guide: Installing Claude Code on Windows Using WSL - From Setup to Success

Introduction

~~Claude Code currently runs only on Linux and macOS environments, which means Windows users need to utilize WSL (Windows Subsystem for Linux) to get it working~~. This comprehensive guide will walk you through everything from WSL basics to Claude Code installation, ensuring even beginners can follow along without getting lost.

July 2025 Update: Claude Code is now installable directly on Windows! However, several unexplained errors have been reported, so installing via WSL might still be the safer approach.

Prerequisites

Before we begin, make sure you've subscribed to Claude Pro or Max on the claude.ai website.

Understanding WSL and Ubuntu

What is WSL (Windows Subsystem for Linux)?

WSL is a Microsoft-provided feature that allows you to run a Linux environment directly on Windows. Unlike virtual machines, WSL provides a lightweight Linux environment that's integrated with Windows.

WSL Features:

  • Run Linux commands on Windows
  • Cross-platform file system access
  • Fast and lightweight
  • Excellent compatibility with developer tools

What is Ubuntu?

Ubuntu is one of the most popular Linux distributions, known for its user-friendliness and stability. WSL installs Ubuntu by default, and it has excellent compatibility with most development tools.

Step 1: Installing WSL and Ubuntu

1.1 Installing WSL via PowerShell

Let's start by installing WSL:

  1. Press the Windows key to open the search box
  2. Type "PowerShell"
  3. Right-click and select "Run as administrator"
  4. Execute the following command:
wsl --install

This command will automatically install WSL2 and Ubuntu.

Screenshot: WSL installation completion screen

1.2 System Restart

After installation completes, you must restart your system. You can press the Windows button and manually select "Restart".

# To restart via PowerShell
Restart-Computer

1.3 Ubuntu Initial Setup

After restart, Ubuntu will launch automatically.

Screenshot: Ubuntu installation process

During the first launch, complete these settings:

  1. Username Setup
    • Enter any username following the prompts
    • We recommend using lowercase English letters
  2. Password Setup
    • Set a memorable yet secure password
    • The input won't be displayed on screen, but it's being entered correctly
  3. System Update
# Update package list and upgrade system
sudo apt update && sudo apt upgrade -y

Step 2: Setting Up Node.js Environment

Since Claude Code runs on Node.js, we'll install Node.js using NVM (Node Version Manager).

2.1 Installing NVM

In the currently open PowerShell:

# Download and execute NVM installation script
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

2.2 Reloading the Shell

To make NVM available, reload the shell:

source ~/.bashrc

2.3 Installing Node.js

# Install LTS (Long Term Support) version of Node.js
nvm install --lts
nvm use --lts

# Verify installation
node --version
npm --version

If installed correctly, version numbers will be displayed.

Step 3: Installing and Configuring Claude Code

3.1 Installing Claude Code

# Install Claude Code globally using NPM
npm install -g @anthropic-ai/claude-code

3.2 Initial Launch and Setup

# Launch Claude Code
claude

Screenshot: Claude Code's initial launch screen

During the first launch, a setup dialog will appear. Follow the on-screen instructions to complete these settings:

  • Enter your Anthropic API key

Screenshot: Login screen

  • Confirm basic configuration items

Step 4: Windows Integration Setup

4.1 Understanding the File System

Understanding how to access Windows file system from within WSL is helpful:

# Access C drive
cd /mnt/c/

# Access user folder
cd /mnt/c/Users/[your-windows-username]/

# Access desktop
cd /mnt/c/Users/[your-windows-username]/Desktop/

4.2 Setting Up Project Working Directory

Recommended working directory setup considering Windows integration:

# Navigate to home directory
cd ~

# Create project directory
mkdir projects
cd projects

Troubleshooting

Common Issues and Solutions

Q: WSL installation encounters an error A: For Windows 10, your version might be outdated. Update to the latest version using Windows Update.

Q: Ubuntu won't start A: Try manually installing the "Ubuntu" app from Microsoft Store and launching it.

Q: Node.js installation encounters an error A: Check your internet connection and reinstall NVM using these commands:

# Remove NVM directory
rm -rf ~/.nvm

# Reinstall
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc

Conclusion

You're now ready to use Claude Code on Windows! By using WSL, you can access a full-featured Linux development environment right on Windows.

Next Steps:

  • Learn the basics of using Claude Code
  • Master project creation and management
  • Explore integration methods with Windows editors

If you encounter any issues, refer to the official documentation of each tool or ask questions in community forums.

If this guide helped you, please share it or bookmark it! Your support helps us create more helpful content.


About the Author

This guide was written to help developers get Claude Code running smoothly on Windows. Feel free to reach out if you have questions or suggestions for improvements!

Tags: #ClaudeCode #WSL #Windows #Linux #Development #AI #Programming