Troubleshooting2026-02-04

Fix 'Failed to start CLI: Error: spawn npm ENOENT' on Windows

Can't install plugins on Windows? Here is the manual fix and the Node LTS solution.

By: LazyDev•
#Troubleshooting#Windows#Node.js#Environment

Fix "spawn npm ENOENT" on Windows

Error Confirmation

Error: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)

Scope: This error occurs when OpenClaw attempts to install plugins on Windows. The child process spawn fails because Windows cannot locate npm.exe.

Error Code: ENOENT = "Error NO ENTry" — the Windows process loader searched the current directory, system directories, and PATH, but did not find the executable.

Verified Environment

ComponentVersionLast Verified
Operating SystemWindows 10/112026-02-04
Node.js18.x LTS, 20.x LTS2026-02-04
OpenClawLatest stable2026-02-04
ShellPowerShell 7+, CMD2026-02-04

Note: This issue is specific to Windows process spawning behavior. Linux/macOS do not exhibit this failure mode.


3-Minute Sanity Check

Run these commands in the same terminal where you launch OpenClaw:

# 1. Is Node installed?
node --version
# Expected: v18.x.x or v20.x.x

# 2. Is npm accessible in THIS shell?
npm --version
# Expected: A version number

# 3. Where does Windows think npm is?
where npm
# Expected: A path like C:\Program Files\nodejs\npm.cmd

# 4. Is Node.js in your PATH?
$env:PATH -split ';' | Select-String nodejs
# Expected: At least one match

If any of these fail: Do not proceed. Your environment is missing Node.js or npm is not in PATH. Install Node.js LTS from nodejs.org first.


Decision Gate

Stop fighting VRAM physics.

Should you keep fixing this locally?

Continue local debugging only if:

You can reinstall Node.js without breaking other projects
You are allowed to modify system PATH and PowerShell policy
You have not already spent more than ~1 hour on this issue

Stop here if any apply:

You already reinstalled Node once and the error persists
This is a locked-down corporate Windows machine
You are debugging PATH / npm resolution for more than an hour

Past this point, debugging cost usually grows faster than results.


Primary Exit Path: WSL2

Install Windows Subsystem for Linux and run OpenClaw in a native Linux environment.

Why this works:

  • Linux has consistent PATH inheritance between shell and subprocess
  • No .cmd wrapper issues
  • Node.js behavior matches upstream expectations

Time investment: 20-30 minutes

Steps:

# 1. Install WSL2
wsl --install

# 2. Reboot when prompted

# 3. In WSL2 terminal, install Node.js 20 LTS
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install 20
nvm use 20

# 4. Install OpenClaw in WSL2
# (Follow standard Linux instructions)

Verification:

# In WSL2 terminal
node --version  # Should show v20.x.x
npm --version
which npm       # Should show /home/.../.nvm/versions/node/...

Secondary Exit Path (Conditional)

Use a remote Linux environment when:

  • WSL2 is blocked by organizational policy
  • You need GPU resources beyond what local hardware provides
  • You want to avoid any local environment modifications

Solution: Remote Linux VPS

Deploy to a cloud provider and access via SSH. This eliminates Windows-specific environment issues entirely.

Time investment: 15-20 minutes

Steps:

# 1. Provision a Linux VPS (Ubuntu 22.04 recommended)

# 2. SSH into the server
ssh user@your-server-ip

# 3. Install Node.js 20 LTS
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install 20
nvm use 20

# 4. Install OpenClaw
npm install -g @m1heng/openclaw

Why NOT Other Options

OptionRejection Reason
Modify PATH manuallyDoes not persist for subprocess environments; IDEs and terminals inject different PATHs
Use nvm-windowsAdds another layer of PATH indirection; introduces race conditions with system installers
Reinstall Node.jsThe installer correctly adds to PATH, but subprocess environments are sanitized by Windows
Switch to PowerShell 7Does not solve the subprocess environment inheritance issue
Copy npm.cmd to System32Fragile; breaks when Node updates; bypasses package manager entirely
Use npm.cmd explicitlyRequires modifying OpenClaw source code; not maintainable

Last Resort: Native Windows Debugging

Warning: This section is provided for documentation purposes only. If you have exhausted WSL2 and remote options and must use native Windows, proceed with caution.

Prerequisite: Only attempt this if:

  • Your organization prohibits WSL2 and external environments
  • You have explicit approval to modify system-level configurations

Step 1: Confirm Node.js LTS

node --version

If you see v21, v22, or v24: uninstall and install LTS from nodejs.org.

Step 2: Add Node.js to System PATH

  1. Press Win + R, type sysdm.cpl, Enter
  2. Advanced tab → Environment Variables
  3. Under System variables (not User variables), find Path
  4. Click Edit → New
  5. Add: C:\Program Files\nodejs
  6. Click OK on all dialogs
  7. Restart your terminal completely

Step 3: Verify subprocess environment

# Open a FRESH PowerShell (not the one you were using)
node -e "console.log(process.env.PATH.split(';').find(p => p.includes('nodejs')))"

If this returns undefined, the PATH change did not propagate. Reboot your machine.

Step 4: Re-run OpenClaw installer

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\install.ps1

Summary

CheckCommandPass Criteria
Node versionnode --versionv18.x or v20.x
npm in shellnpm --versionReturns version
npm on diskwhere npmReturns path
npm in subprocessnode -e "console.log(process.env.PATH)"Contains nodejs path

Decision:

  • All pass: Your environment is correct. The issue may be OpenClaw-specific. Report the bug with your diagnostic output.
  • Any fail: Use WSL2 or consult your system administrator.

Last resort: If you have spent more than 1 hour on this, stop debugging Windows internals. Use WSL2 or a remote Linux environment. The expected time investment for WSL2 is 20 minutes; continued debugging has unbounded time cost.

Bookmark this site

New fixes are added as soon as they appear on GitHub Issues.

Browse Error Index →