Installation & Setup Windows Install

OpenClaw Install Windows: The Definitive Windows Setup Guide

OpenClaw runs natively on Windows — no WSL required. But Windows throws curveballs that Linux docs don't warn you about: PATH pollution, Defender false positives, execution policy blocks. Here's every fix in order.

SR
S. Rivera
AI Infrastructure Lead
Jan 23, 2025 14 min read 8.4k views
Updated Jan 23, 2025
Key Takeaways
  • Install Node.js 20 or 22 LTS from nodejs.org — the installer handles PATH automatically on Windows
  • Run PowerShell as Administrator for npm install -g openclaw — avoids the permission errors that stop most people
  • If openclaw is "not recognized", the npm global bin directory is missing from your PATH — fixable in 2 minutes
  • Windows Defender may quarantine npm packages — add an exclusion for the npm global directory to prevent it
  • Use nssm to wrap the OpenClaw gateway as a proper Windows service that starts at boot without user login

Windows gets OpenClaw running in about 20 minutes if you know the sequence. Most people spend 2 hours because they hit three specific Windows issues in a row — PATH not updating, Defender blocking packages, execution policy rejecting scripts. We've seen these consistently. Fix them once, in order, and the rest is straightforward.

Step 1: Install Node.js on Windows

Go to nodejs.org and download the Windows installer for Node.js 22 LTS (the current long-term support release as of early 2025). Run the .msi installer.

During installation, check the box that says "Automatically install the necessary tools". This installs native build tools via Chocolatey — some OpenClaw dependencies may need them. The installer will open a separate PowerShell window to complete this; let it finish.

After installation, open a new PowerShell window (important — existing windows won't have the updated PATH) and verify:

# Open a NEW PowerShell window after installation
node --version   # Should show v22.x.x
npm --version    # Should show 10.x.x

If either command is not recognized, the PATH update from the installer didn't take. Restart your machine — a full restart reliably refreshes PATH on Windows in a way that opening a new terminal does not always achieve.

💡
Use Windows Terminal, Not the Old cmd.exe

Windows Terminal (available free from the Microsoft Store) gives you a proper tabbed terminal with PowerShell support. It handles long paths, Unicode output, and ANSI colors correctly — all of which matter for OpenClaw's log output. Install it before proceeding if you haven't already.

Step 2: Verify and Fix PATH Configuration

This is the most common issue with npm on Windows. The global npm packages directory isn't always added to PATH correctly.

Find where npm puts global binaries:

npm config get prefix
# Typical output: C:\Users\YourName\AppData\Roaming\npm

Check if that directory is in your PATH:

$env:PATH -split ";" | Where-Object { $_ -like "*npm*" }

If nothing returns, you need to add the npm directory to your PATH. Here's how — run this in PowerShell as Administrator:

# Get the npm prefix path
$npmPath = npm config get prefix

# Add it to the user PATH permanently
[Environment]::SetEnvironmentVariable(
  "PATH",
  "$env:PATH;$npmPath",
  [EnvironmentVariableTarget]::User
)

# Reload PATH in current session
$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "User")

Close and reopen PowerShell. The npm global bin directory is now in your PATH for all future sessions.

Step 3: Install OpenClaw

Open PowerShell as Administrator. Right-click the PowerShell icon and select "Run as administrator". This is required because npm global installations write to directories that need elevated permissions on Windows.

npm install -g openclaw

Watch the output. If you see permission errors, you're not running as Administrator. If you see network errors, check your proxy settings — corporate networks sometimes block npm's registry. If Defender quarantines something mid-install, see the warning box below.

After successful installation:

openclaw --version

If this returns a version number, the install worked. If it says "not recognized as the name of a cmdlet", your PATH fix from Step 2 hasn't propagated yet — close and reopen PowerShell.

⚠️
If Windows Defender Quarantines Files During Install

Open Windows Security > Virus & Threat Protection > Protection History. Find the quarantined npm file and click Restore. Then go to Virus & Threat Protection Settings > Exclusions and add the npm global directory (C:\Users\YourName\AppData\Roaming\npm). Re-run npm install -g openclaw afterward. This is a Defender false positive on npm binaries — a known issue.

Step 4: Initialize and Start the Gateway

Create a directory for your OpenClaw server files and initialize the gateway config:

# Create server directory
mkdir C:\openclaw-server
cd C:\openclaw-server

# Initialize gateway configuration
openclaw init --gateway

If you get a script execution error ("running scripts is disabled on this system"), your PowerShell execution policy is blocking it. Fix it:

# Allow locally created scripts to run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Now edit the generated gateway.yaml. Open it in Notepad or VS Code:

notepad gateway.yaml

Set your gateway token (generate one with any password manager or use PowerShell):

# Generate a random token in PowerShell
-join ((48..57) + (65..90) + (97..122) | Get-Random -Count 32 | ForEach-Object {[char]$_})

Paste it into gateway.yaml as your token. Save. Start the gateway:

cd C:\openclaw-server
openclaw gateway start

You should see the gateway start message. Verify in a second PowerShell window:

Invoke-WebRequest -Uri http://localhost:8080/health | Select-Object -ExpandProperty Content
# Should return: {"status":"ok"}

Running OpenClaw as a Windows Service

The gateway needs to run at boot without requiring a user login. Windows Task Scheduler works but is fragile. nssm (Non-Sucking Service Manager) wraps any process as a proper Windows service.

Download nssm from nssm.cc and put the 64-bit executable in C:\Windows\System32\ or another PATH directory. Then:

# Install OpenClaw as a Windows service
nssm install openclaw-gateway

# In the nssm GUI:
# Path: C:\Program Files\nodejs\node.exe
# Startup directory: C:\openclaw-server
# Arguments: C:\Users\YourName\AppData\Roaming\npm\node_modules\openclaw\bin\openclaw.js gateway start

# Then start the service
nssm start openclaw-gateway

# Verify it's running
sc query openclaw-gateway

The service now starts at boot, runs under the SYSTEM account (no user login required), and restarts automatically if it crashes.

Common Windows-Specific Errors and Fixes

Error Cause Fix
openclaw not recognizednpm global bin not in PATHAdd npm prefix to user PATH, restart terminal
EACCES permission deniedNot running as AdministratorRe-run PowerShell as Administrator
Scripts disabled errorPowerShell execution policySet-ExecutionPolicy RemoteSigned -Scope CurrentUser
ENOENT during npm installPath too long (Windows 260 char limit)Enable long path support in Group Policy or registry
Port 8080 already in useAnother process has the portnetstat -ano | findstr :8080 to find PID, change port in gateway.yaml

Frequently Asked Questions

Does OpenClaw work natively on Windows without WSL?

Yes. OpenClaw runs natively on Windows via Node.js without WSL. Install Node.js from nodejs.org, run npm install -g openclaw in PowerShell, and the gateway runs on Windows directly. WSL gives a Linux environment but is not required for OpenClaw operation.

Why does openclaw show as not recognized in PowerShell?

The npm global bin directory is missing from your Windows PATH. Run npm config get prefix to find the directory, add it to your user PATH via Environment Variables in System Properties, and restart PowerShell. The fix takes under 2 minutes once you know where to look.

Should I use PowerShell or Command Prompt?

PowerShell. It handles long paths better, produces cleaner output, and supports the scripting you'll need for service setup. Windows Terminal with PowerShell as default is the right setup for running and monitoring OpenClaw on Windows.

How do I run the OpenClaw gateway as a Windows service?

Use nssm to wrap the gateway as a Windows service. Point nssm at the node executable with the OpenClaw gateway script as an argument. The service runs at boot without user login and restarts on crash automatically.

Does Windows Defender block OpenClaw?

Defender may flag npm packages during installation as a false positive. Restore quarantined files from Protection History, add the npm global directory as an exclusion, then reinstall. The OpenClaw package contains no malicious code — this is a known Defender pattern with npm binaries.

What Node.js version for OpenClaw on Windows?

Node.js 20 LTS or 22 LTS from nodejs.org. The Windows installer handles PATH configuration automatically. Node.js 22 LTS has the longest support window and best native module compatibility for Windows deployments.

SR
S. Rivera
AI Infrastructure Lead

S. Rivera deploys AI agent infrastructure across Windows, Linux, and hybrid environments for enterprise clients. Has debugged every Windows-specific npm and Node.js issue that exists, and documents the fixes so others don't spend the same hours.

Windows Setup Guides

Weekly OpenClaw tips for Windows users and infrastructure leads, free.