304 lines
7.3 KiB
Markdown
304 lines
7.3 KiB
Markdown
# Claude Code Installer for Windows
|
|
|
|
A colorized, interactive PowerShell installer script that automates the installation of [Claude Code](https://docs.anthropic.com/en/docs/claude-code) on Windows systems.
|
|
|
|

|
|

|
|

|
|

|
|
|
|
---
|
|
|
|
## Quick Install
|
|
|
|
**One-line installation (Run in PowerShell as Administrator):**
|
|
|
|
```powershell
|
|
irm https://git.bitmaster.cc/BitMaster/claude/raw/branch/main/claude-code-installer.ps1 | iex
|
|
```
|
|
|
|
**Or with full command:**
|
|
|
|
```powershell
|
|
Invoke-RestMethod https://git.bitmaster.cc/BitMaster/claude/raw/branch/main/claude-code-installer.ps1 | Invoke-Expression
|
|
```
|
|
|
|
> ⚠️ **Note:** You may need to run PowerShell as Administrator for the installation to complete successfully.
|
|
|
|
---
|
|
|
|
## Manual Installation
|
|
|
|
**Step 1:** Download the installer script
|
|
|
|
```powershell
|
|
Invoke-WebRequest -Uri "https://git.bitmaster.cc/BitMaster/claude/raw/branch/main/claude-code-installer.ps1" -OutFile "claude-code-installer.ps1"
|
|
```
|
|
|
|
**Step 2:** Allow script execution (if needed)
|
|
|
|
```powershell
|
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
```
|
|
|
|
**Step 3:** Run the installer
|
|
|
|
```powershell
|
|
.\claude-code-installer.ps1
|
|
```
|
|
|
|
---
|
|
|
|
## Features
|
|
|
|
### 🔍 System Detection
|
|
|
|
| Feature | Description |
|
|
|---------|-------------|
|
|
| **Windows Detection** | Identifies Windows version and build number |
|
|
| **Architecture** | Detects x64, x86, or ARM64 for correct Node.js download |
|
|
| **System Info** | Shows computer name, RAM, and PowerShell version |
|
|
| **Admin Check** | Verifies if running with Administrator privileges |
|
|
|
|
### 📦 Node.js Management
|
|
|
|
| Feature | Description |
|
|
|---------|-------------|
|
|
| **Version Check** | Checks if Node.js/npm are installed and their versions |
|
|
| **Compatibility** | Detects if the version is compatible (v18+ required) |
|
|
| **Clean Removal** | Uninstalls existing Node.js via Windows installer |
|
|
| **Fresh Install** | Downloads and installs Node.js 20 LTS from nodejs.org |
|
|
| **Verification** | Verifies installation after completion |
|
|
|
|
### 🛡️ Permission Modes
|
|
|
|
When the installation completes, you'll be prompted to choose how Claude Code runs:
|
|
|
|
| Mode | Flag | Description |
|
|
|------|------|-------------|
|
|
| **1. Normal Mode** | *(default)* | Asks before each operation — **safest option** |
|
|
| **2. Auto-Accept Edits** | `--auto-accept-edits` | Auto-accepts file changes, confirms commands |
|
|
| **3. Full Auto Mode** | `--dangerously-skip-permissions` | Skips all prompts — **use with caution!** |
|
|
| **4. Exit** | — | Don't start Claude, just complete installation |
|
|
|
|
---
|
|
|
|
## System Requirements
|
|
|
|
| Requirement | Minimum |
|
|
|-------------|---------|
|
|
| **Operating System** | Windows 10 / Windows 11 / Windows Server 2016+ |
|
|
| **PowerShell** | Version 5.1 or later |
|
|
| **Architecture** | x64, x86, or ARM64 |
|
|
| **Permissions** | Administrator recommended |
|
|
| **Internet** | Required for downloading packages |
|
|
|
|
---
|
|
|
|
## What Gets Installed
|
|
|
|
1. **Node.js 20 LTS** — JavaScript runtime (if not already installed or outdated)
|
|
2. **npm** — Node package manager (comes with Node.js)
|
|
3. **Claude Code** — Anthropic's CLI tool for AI-assisted coding
|
|
|
|
### Installation Paths
|
|
|
|
| Component | Default Location |
|
|
|-----------|------------------|
|
|
| Node.js | `C:\Program Files\nodejs\` |
|
|
| npm global packages | `%APPDATA%\npm\` |
|
|
| npm cache | `%APPDATA%\npm-cache\` |
|
|
| Claude Code | `%APPDATA%\npm\claude.cmd` |
|
|
|
|
---
|
|
|
|
## Post-Installation
|
|
|
|
After installation, you can start Claude Code anytime:
|
|
|
|
**Command Prompt or PowerShell:**
|
|
|
|
```cmd
|
|
# Normal mode (recommended)
|
|
claude
|
|
|
|
# Auto-accept file edits
|
|
claude --auto-accept-edits
|
|
|
|
# Full auto mode (dangerous)
|
|
claude --dangerously-skip-permissions
|
|
```
|
|
|
|
If the `claude` command is not recognized, restart your terminal or open a new PowerShell/Command Prompt window.
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
### "claude" is not recognized
|
|
|
|
**Solution 1:** Restart your terminal (PowerShell/Command Prompt)
|
|
|
|
**Solution 2:** Refresh environment variables
|
|
|
|
```powershell
|
|
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
|
```
|
|
|
|
**Solution 3:** Manually add npm to PATH
|
|
|
|
```powershell
|
|
$env:Path += ";$env:APPDATA\npm"
|
|
```
|
|
|
|
### Execution Policy Error
|
|
|
|
If you see "cannot be loaded because running scripts is disabled":
|
|
|
|
```powershell
|
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
```
|
|
|
|
### Permission Denied / Access Denied
|
|
|
|
Run PowerShell as Administrator:
|
|
|
|
1. Right-click on PowerShell
|
|
2. Select "Run as administrator"
|
|
3. Run the installer again
|
|
|
|
### Node.js Installation Fails
|
|
|
|
**Option 1:** Download and install manually from [nodejs.org](https://nodejs.org/)
|
|
|
|
**Option 2:** Use winget (Windows Package Manager):
|
|
|
|
```powershell
|
|
winget install OpenJS.NodeJS.LTS
|
|
```
|
|
|
|
**Option 3:** Use Chocolatey:
|
|
|
|
```powershell
|
|
choco install nodejs-lts
|
|
```
|
|
|
|
### npm Install Fails
|
|
|
|
Clear npm cache and retry:
|
|
|
|
```powershell
|
|
npm cache clean --force
|
|
npm install -g @anthropic-ai/claude-code
|
|
```
|
|
|
|
---
|
|
|
|
## Uninstallation
|
|
|
|
### Remove Claude Code
|
|
|
|
```powershell
|
|
npm uninstall -g @anthropic-ai/claude-code
|
|
```
|
|
|
|
### Remove Node.js
|
|
|
|
**Option 1:** Via Windows Settings
|
|
1. Open Settings → Apps → Installed apps
|
|
2. Search for "Node.js"
|
|
3. Click Uninstall
|
|
|
|
**Option 2:** Via Control Panel
|
|
1. Open Control Panel → Programs → Uninstall a program
|
|
2. Find "Node.js"
|
|
3. Click Uninstall
|
|
|
|
**Option 3:** Via PowerShell
|
|
|
|
```powershell
|
|
# Find and uninstall Node.js
|
|
Get-Package -Name "*Node*" | Uninstall-Package
|
|
```
|
|
|
|
### Clean Up Remaining Files
|
|
|
|
```powershell
|
|
# Remove npm cache and global packages
|
|
Remove-Item -Recurse -Force "$env:APPDATA\npm" -ErrorAction SilentlyContinue
|
|
Remove-Item -Recurse -Force "$env:APPDATA\npm-cache" -ErrorAction SilentlyContinue
|
|
```
|
|
|
|
---
|
|
|
|
## Alternative Installation Methods
|
|
|
|
### Using winget (Windows Package Manager)
|
|
|
|
```powershell
|
|
# Install Node.js
|
|
winget install OpenJS.NodeJS.LTS
|
|
|
|
# Install Claude Code
|
|
npm install -g @anthropic-ai/claude-code
|
|
```
|
|
|
|
### Using Chocolatey
|
|
|
|
```powershell
|
|
# Install Chocolatey (if not installed)
|
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
|
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
|
|
|
# Install Node.js
|
|
choco install nodejs-lts
|
|
|
|
# Install Claude Code
|
|
npm install -g @anthropic-ai/claude-code
|
|
```
|
|
|
|
### Using Scoop
|
|
|
|
```powershell
|
|
# Install Scoop (if not installed)
|
|
irm get.scoop.sh | iex
|
|
|
|
# Install Node.js
|
|
scoop install nodejs-lts
|
|
|
|
# Install Claude Code
|
|
npm install -g @anthropic-ai/claude-code
|
|
```
|
|
|
|
---
|
|
|
|
## License
|
|
|
|
This installer script is provided under the MIT License.
|
|
|
|
Claude Code is a product of [Anthropic](https://www.anthropic.com/).
|
|
|
|
---
|
|
|
|
## Links
|
|
|
|
- [Claude Code Documentation](https://docs.anthropic.com/en/docs/claude-code)
|
|
- [Anthropic](https://www.anthropic.com/)
|
|
- [Node.js](https://nodejs.org/)
|
|
- [Node.js Downloads](https://nodejs.org/en/download/)
|
|
|
|
---
|
|
|
|
## Contributing
|
|
|
|
Issues and pull requests are welcome at:
|
|
|
|
**https://git.bitmaster.cc/BitMaster/claude**
|
|
|
|
---
|
|
|
|
<p align="center">
|
|
<sub>Made with ❤️ for the Claude community</sub>
|
|
</p>
|