Installation Failure on Windows - Unsupported OS Error
Resolved 💬 9 comments Opened Feb 27, 2025 by SpeedRanger Closed Feb 27, 2025
Description:
I attempted to install @anthropic-ai/claude-code on WSL using the following command:
npm install -g @anthropic-ai/claude-code --force --no-os-check
However, the installation failed with the following error message:
npm WARN using --force Recommended protections disabled.
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup [
npm WARN cleanup 'C:\\Users\\<USER>\\AppData\\Roaming\\npm\\node_modules\\@anthropic-ai\\claude-code',
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\<USER>\AppData\Roaming\npm\node_modules\@anthropic-ai\claude-code\vendor\sdk\src\internal'] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: 'EPERM',
npm WARN cleanup syscall: 'rmdir',
npm WARN cleanup path: 'C:\\Users\\<USER>\\AppData\\Roaming\\npm\\node_modules\\@anthropic-ai\\claude-code\\vendor\\sdk\\src\\internal'
npm WARN cleanup }
npm WARN cleanup ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\<USER>\AppData\Roaming\npm\node_modules\@anthropic-ai\claude-code
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/preinstall.js
npm ERR! Error: Claude Code is not supported on Windows.
npm ERR! Claude Code requires macOS or Linux to run properly.
npm ERR! If you are using WSL (Windows Subsystem for Linux):
npm ERR! 1. Make sure you are running npm install from within the WSL terminal, not from PowerShell or CMD
npm ERR! 2. If you're still seeing this message in WSL, your environment may be incorrectly reporting as Windows
npm ERR! Please visit https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview#check-system-requirements for troubleshooting information.
Expected Behavior
- The package should either install successfully or clearly state during the npm install process that it does not support Windows, before attempting installation.
Actual Behavior
- The installation proceeds partially, attempts cleanup, then fails with an EPERM error.
- The error message suggests running the installation in WSL, but I am already running this inside WSL on the command line.
- The script still detects Windows incorrectly and prevents installation.
Steps to Reproduce
- Open a WSL terminal
- Run the command:
npm install -g @anthropic-ai/claude-code --force --no-os-check
System Information
OS: WSL (Ubuntu on Windows 10/11)
NPM Version: 10.2.3
WSL Version: 2.4.11.0
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗