If you are running OpenClaw on native Windows rather than inside WSL2, the core mistake is treating âWindowsâ as one environment.
It is not.
For OpenClaw, there are usually at least three different runtime contexts:
- the shell where you install or test commands,
- the gateway service started via Scheduled Task,
- the node host process started by
openclaw node run.
That difference explains most reports like:
- â
openclawis installed, but the command is not recognizedâ - â
where dockerworks in PowerShell, buttools.execcannot finddockerorrgâ - â
openclaw node runprints PATH and then hangsâ - â
execonly works withpty: trueon Windowsâ - âthe installer failed and PowerShell closed before I could even read the reasonâ
This guide turns those into a predictable playbook.
What this guide helps you finish
By the end of this guide, you should be able to:
- identify which Windows runtime actually owns the failure,
- choose the right fix for shell, gateway service, or node host,
- prove whether native Windows is stable enough for your use case,
- stop wasting time on fixes that only work in one of the three environments.
Who this is for (and not for)
This guide is for operators who:
- intentionally want native Windows,
- are seeing PATH, Scheduled Task, node-host, or service-behavior weirdness,
- need a field guide for real Windows runtime boundaries.
This guide is not for:
- readers still deciding between native and WSL2,
- people who mainly need install basics,
- operators who already know the issue disappears in WSL2 and only need migration steps.
Before you debug: collect these five facts
Before you change anything, capture:
- Which shell the install and manual checks succeed in.
- Whether the gateway is running in foreground or via Scheduled Task.
- Whether the failing action is gateway-host
execoropenclaw node run. - Which external CLIs must be discoverable (
docker,rg,gh, etc.). - Whether locale, non-ASCII paths, or service-session behavior might be involved.
High-value related pages:
- Install OpenClaw on Windows - Windows 10/11 & WSL2 Setup Guide
- OpenClaw on Windows: Native vs WSL2, Install Paths, and When to Switch
- OpenClaw Installation Troubleshooting: Node/NPM, PATH, Windows (WSL2), and Docker
- Windows: âopenclawâ is not recognized after install
- Windows: installer fails and PowerShell closes before you can read the error
- Windows: tools.exec cannot find docker, rg, or gh even though they work in PowerShell
- Windows native: node run hangs after printing PATH, or the runtime stays unstable
- Windows: Exec tool returns empty output unless
pty: true - OpenClaw Configuration Guide: openclaw.json, Models, Gateway, Channels, and Plugins
- Enable Tools and Plugins (Advanced)
- OpenClaw Deployment Troubleshooting: Persistent State, Gateway Token, STARTING/Probe Failures, and Fast Recovery
1) The bottom line: what is actually recommended?
If you are starting fresh, WSL2 remains the lower-risk Windows path.
Native Windows is still usable, but you should think of it as:
- fine for targeted local use, especially when you keep the gateway in a foreground shell while debugging,
- more fragile for background service setups, PATH-sensitive tools, and node-host edge cases,
- more sensitive to locale / username / service-environment differences than WSL2.
So the right operator stance is not ânative Windows is impossible.â
It is:
- use native Windows when you know why you want it,
- reduce variables aggressively,
- move to WSL2 when the remaining friction is mostly Windows-specific plumbing.
2) The three environments you must not mix up
A) Interactive shell
This is the PowerShell or cmd session where you run:
where openclaw
where docker
where rg
openclaw doctor
This shell is the truth for what you can run manually right now.
B) Gateway service (Scheduled Task)
On native Windows, the gateway service is launched through a generated wrapper under your state directory, commonly:
%USERPROFILE%\.openclaw\gateway.cmd
That means the gateway service can end up using a different PATH from the shell you are currently looking at.
This is the root of a very common failure:
where dockersucceeds in PowerShell,- but
tools.execinside OpenClaw saysdockerorrgis not found.
C) Node host (openclaw node run)
This is a separate runtime again.
Its PATH and startup chain are not identical to the gateway service. So a fix that helps gateway-host exec is not automatically a fix for node-host startup.
This matters because:
tools.exec.pathPrependis useful for gateway-host exec,- but it is not the right explanation for every
openclaw node runhang.
If you remember only one thing from this guide, remember this:
âWorks in my shellâ does not prove âworks in the Windows serviceâ or âworks in the node host.â
3) The stable baseline for native Windows
Before debugging deeper, reduce the setup to this baseline.
3.1 Install normally
Use the boring install path:
npm install -g openclaw@latest
Do not normalize:
npm install -g openclaw --ignore-scripts
--ignore-scripts is useful for special packaging or security workflows, but it is a bad default for day-to-day runtime debugging because it increases the chance of a half-installed environment.
3.2 If the installer closes PowerShell, switch to the manual route
Some Windows users hit the opposite failure: they are not even debugging OpenClaw yet â they are debugging the installer entrypoint.
Typical pattern:
iwr ...install.ps1 | iexfails,- PowerShell closes too quickly,
- the real error is something like âcould not find winget / choco / scoopâ or âNode is missingâ.
In that situation, stop fighting the bootstrapper and go one layer lower:
- install Node.js 22+ manually,
- open a fresh PowerShell,
- run the normal npm install path.
npm install -g openclaw@latest
openclaw --version
openclaw doctor
This gives you readable failure output and removes one moving part.
3.3 Verify from one shell first
In the same shell where you plan to install or run services, verify:
where openclaw
node -v
openclaw --version
openclaw doctor
If you care about CLI tools later used by tools.exec, verify them here too:
where docker
where rg
3.4 Prefer foreground gateway while debugging
Before you daemonize, prove the runtime works in the foreground:
openclaw gateway run --port 18789
Why this is so valuable:
- foreground
gateway runeliminates Scheduled Task as a variable, - it tells you whether the bug is really the service environment,
- it gives cleaner logs than âservice seems installed but tool resolution is wrong.â
Only after that is clean should you rely on:
openclaw gateway install --force --runtime node --port 18789
4) The real native Windows failure modes
4.1 openclaw is not recognized after install
Symptoms:
- PowerShell says
'openclaw' is not recognized as an internal or external command - install appeared to succeed, but the CLI is missing
This is usually not an OpenClaw runtime bug. It is a global npm PATH problem.
Start here:
4.2 tools.exec cannot find docker, rg, or other installed CLI tools
Symptoms:
where dockerworks in PowerShell,where rgworks in PowerShell,- but
tools.execreports command-not-found behavior.
Treat this first as a gateway service PATH problem, not an exec bug.
Do this in order:
- reinstall the gateway from the same shell where
where docker/where rgalready succeed, - inspect
%USERPROFILE%\.openclaw\gateway.cmd, - only then change config.
Fast path:
openclaw gateway stop
openclaw gateway uninstall
openclaw gateway install --force --runtime node --port 18789
If the gateway service still cannot resolve tools, tools.exec.pathPrepend can be the right fix for gateway-host exec:
{
tools: {
exec: {
pathPrepend: [
"C:\\Program Files\\Docker\\Docker\\resources\\bin",
"C:\\Users\\<you>\\AppData\\Local\\Microsoft\\WinGet\\Links"
]
}
}
}
Then restart the gateway:
openclaw gateway restart
But keep two caveats in your head:
tools.exec.pathPrependhelps when exec runs on the gateway or in the sandbox; it is not a node-host fix.- some Windows issue reports have shown versions where
pathPrependbehaved badly enough to effectively break PATH resolution. If enabling it makes evenpowershellorwhere.exedisappear inside exec, remove it from config directly and fall back to full executable paths, foreground gateway testing, or WSL2.
If you need an immediate unblock, call the binary by full path instead of relying on PATH lookup.
4.3 gateway.cmd is diagnostic output, not a durable customization surface
%USERPROFILE%\.openclaw\gateway.cmd is useful because it tells you what the Scheduled Task is really going to run.
That makes it great for diagnosis:
- inspect the
PATHline, - confirm the command path,
- compare what the service sees vs what your shell sees.
But it is not a good long-term config surface:
openclaw gateway install --forcecan regenerate it,- updates can overwrite manual edits,
- user-specific hacks in that file are easy to forget during upgrades.
So the safe rule is:
- inspect
gateway.cmdto understand the failure, - avoid depending on hand-edited lines there for long-term correctness.
If the only reliable fix requires hand-maintaining gateway.cmd, that is a sign you should either:
- move the fix into supported config,
- run foreground/manual gateway on native Windows,
- or move the setup to WSL2.
4.4 openclaw node run prints PATH and then hangs
Symptoms:
- you see a line like
node host PATH: ..., - then there is no successful connection message,
- the process appears stuck before becoming a usable node host.
Do not jump straight to âgateway networking is broken.â
First reduce the highest-risk variables:
- remove
--ignore-scriptsfrom the install path, - test from a fresh shell,
- confirm gateway and node host are started from the same environment,
- if you can, reproduce in WSL2 before going deeper into native Windows.
Why this is the right order:
- by the time PATH is printed, you are already past basic CLI parsing,
- the remaining problem is usually runtime startup, host environment, or a native Windows edge case,
- WSL2 is the fastest control experiment for âis this OpenClaw generally broken, or is native Windows the variable?â
4.5 exec produces empty output unless pty: true
This is a separate Windows-specific failure mode.
If commands appear to do nothing with non-PTY exec, do not keep guessing. Use the dedicated workaround:
4.6 Scheduled Task is not the same thing as a real Windows Service
This distinction matters more than many users expect.
The built-in native Windows daemon path is centered on Scheduled Task behavior. That is not the same as a classic always-on Windows service running in Session 0.
This matters if you expect:
- true boot-time startup without an interactive login,
- service-account behavior,
- config rooted somewhere other than the signed-in userâs normal home context,
- âserver-styleâ Windows operation rather than âdesktop user with a supervised background taskâ.
If your requirement is really âI need a true service model, not a desktop-session task,â native Windows becomes much less friendly, and WSL2 or another Linux host is usually the more predictable option.
4.7 Locale, path spaces, and non-ASCII paths are a real risk bucket
Several Windows issues are not âPATH problemsâ at all. They come from native Windows differences such as:
- non-ASCII usernames or hostnames,
- localized Windows service output,
- path quoting when executable locations include spaces,
- status parsing assumptions that hold on English systems but not elsewhere.
That does not mean every Chinese / German / Russian Windows system will fail.
It means that if you are debugging a native Windows issue on:
- Windows 11 24H2,
- a localized OS,
- a profile path with non-ASCII characters,
- or a Node/npm install under
C:\Program Files\...,
you should reduce variables earlier than you would on Linux.
The fastest control tests are:
- a clean reinstall without
--ignore-scripts, - a fresh shell,
- a foreground
gateway run, - a WSL2 reproduction.
5) When native Windows is still a good choice
Native Windows is reasonable when most of these are true:
- you want local-only usage on one machine,
- you are comfortable using PowerShell and inspecting PATH directly,
- you do not need a large fleet of external CLI tools discovered through service-launched PATH lookup,
- you are okay debugging in foreground before moving to a background service.
In practice, the lowest-friction native Windows pattern is often:
- install normally,
- validate in one shell,
- keep the gateway foreground while stabilizing config,
- only then switch to Scheduled Task if you still want background launch.
6) When to stop fighting native Windows and move to WSL2
Move to WSL2 if one or more of these is true:
- you depend heavily on Unix-style CLI tooling,
- you need the most reproducible PATH and service behavior,
- you are already losing time on Scheduled Task / PATH / locale quirks,
- your issue disappears the moment you run the same flow in WSL2,
- what you really want is a true always-on service model rather than a desktop-session task.
This is not âgiving up.â
It is choosing the environment that matches OpenClawâs most repeatable Windows deployment path.
If you want that route, start here:
- OpenClaw on Windows: Native vs WSL2, Install Paths, and When to Switch
- Install OpenClaw on Windows - Windows 10/11 & WSL2 Setup Guide
- Windows (WSL2): gateway service install fails (systemd not enabled)
7) The minimum evidence bundle for a real Windows issue report
When you open an issue or debug a stubborn native Windows problem, avoid vague reports like âit hangsâ or âtool not found.â
Collect this instead:
openclaw --version
node -v
openclaw doctor
openclaw gateway status
where openclaw
where docker
where rg
And then add the environment-specific proof:
- for gateway service issues: the relevant lines from
%USERPROFILE%\.openclaw\gateway.cmd, - for node host issues: the full last lines after
node host PATH: ..., - for tool lookup issues: whether full executable paths work even when PATH lookup fails,
- for installer/bootstrap issues: the exact manual Node/npm path you used after the one-liner failed,
- for locale-sensitive issues: your Windows version, locale, and whether the username/path contains non-ASCII characters.
That turns âWindows is brokenâ into something maintainable.
Verification: prove native Windows is actually stable
Before you call the setup âfixed,â confirm:
- the same command works in the intended runtime, not only in one interactive shell,
- the gateway still behaves after restart,
- the tools you care about resolve from the real execution context,
- the node host either starts cleanly or is clearly out of scope for this machine,
- the remaining friction is no longer mostly Windows-specific plumbing.
If you cannot pass those checks, the most honest fix may still be WSL2.
What to keep stable if you stay native
If native Windows remains the right choice, keep these stable:
- one verified shell for installs and manual checks,
- one understood service model,
- one predictable PATH strategy,
- one clear distinction between gateway-host fixes and node-host fixes.
That discipline matters more than any one-off workaround.
Related
- OpenClaw on Windows: Native vs WSL2, Install Paths, and When to Switch
- OpenClaw Installation Troubleshooting: Node/NPM, PATH, Windows (WSL2), and Docker
- Windows: âopenclawâ is not recognized after install
- Windows: installer fails and PowerShell closes before you can read the error
- Windows: tools.exec cannot find docker, rg, or gh even though they work in PowerShell
- Windows native: node run hangs after printing PATH, or the runtime stays unstable
- Windows: Exec tool returns empty output unless
pty: true - OpenClaw Configuration Guide: openclaw.json, Models, Gateway, Channels, and Plugins
- Enable Tools and Plugins (Advanced)
- OpenClaw Deployment Troubleshooting: Persistent State, Gateway Token, STARTING/Probe Failures, and Fast Recovery
- Windows (WSL2): gateway service install fails (systemd not enabled)