ClawKit Logo
ClawKitReliability Toolkit

Fix OpenClaw npm Install Errors on Windows

This page covers installation errors only. If OpenClaw is installed but the Gateway is crashing or not starting, see Windows Gateway Service Errors.

Installing OpenClaw on Windows can fail at several points — PowerShell execution restrictions, missing Git, EBUSY locks, or the postinstall step crashing with exit code 3221225477. This guide covers every install blocker in order.

Error: PSSecurityException — Script Blocked

npm : File C:\Program Files\nodejs\npm.ps1 cannot be loaded because running
scripts is disabled on this system. (PSSecurityException)

Windows PowerShell blocks .ps1 script execution by default. You have two options:

Option A: Use .cmd Shims (Recommended)

No security settings changed. Use .cmd instead of the default .ps1 shims:

npm.cmd install -g openclaw
openclaw.cmd gateway start

Option B: Change Execution Policy

Run PowerShell as Administrator:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Lowers system security. Option A is safer.

For a dedicated guide on this error, see Fix PowerShell Scripts Blocked.

Error: spawn git ENOENT — Git Not Found

npm error syscall spawn git / ENOENT

Git is required by OpenClaw's postinstall step but isn't installed or isn't in PATH. Fix:

Install Git for Windows
winget install Git.Git

# After installation, close and reopen your terminal
# PATH won't update until you restart
git --version

If winget isn't available, download Git directly from git-scm.com and check "Add Git to PATH" during installation.

Error: EBUSY — Resource Locked During Update

npm error code EBUSY — resource busy or locked

The node_modules folder is locked by a running process. To fix:

  1. Stop the Gateway: openclaw gateway stop
  2. Close all terminals that are open in the OpenClaw directory
  3. Close VS Code or any editor with the folder open
  4. Retry: npm.cmd install -g openclaw@latest

If it still fails, open Task Manager, find any node.exe processes, and end them manually before retrying.

Error: exit code 3221225477 / Postinstall Crash

npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node ./dist/cli/cli.js postinstall
npm error Exit code: 3221225477

Exit code 3221225477 (0xC0000005) is a Windows access violation. The postinstall script crashed — usually because:

1

Antivirus blocking Node.js

Windows Defender or third-party AV is blocking the postinstall script. Temporarily disable real-time protection, install, then re-enable.

2

Insufficient permissions

Run your terminal as Administrator. Right-click PowerShell or Command Prompt → "Run as administrator", then retry the install.

3

Corrupted Node.js install

The node.exe binary itself is corrupted. Reinstall Node.js LTS from nodejs.org.

4

DEP (Data Execution Prevention)

Windows DEP is blocking the script. This is rare but try running from a standard Command Prompt (not PowerShell).

Install as Administrator (cmd.exe)
# Run this in Command Prompt as Administrator (not PowerShell)
npm install -g openclaw

# If that fails, try clearing the npm cache first
npm cache clean --force
npm install -g openclaw

Warning: CRITICAL — Config Writable by Other Users

[CRITICAL] openclaw.json is writable by other users/groups
[CRITICAL] credentials directory is writable by other users/groups

OpenClaw's security audit found that other Windows users can read or modify your config and API keys. Fix with icacls (run as Administrator):

Restrict config permissions (Run as Administrator)
# Lock down the config file
icacls "%USERPROFILE%\.openclaw\openclaw.json" /inheritance:r /grant:r "%USERNAME%:(R,W)" /grant:r "SYSTEM:(R,W)"

# Lock down the credentials directory
icacls "%USERPROFILE%\.openclaw\credentials" /inheritance:r /grant:r "%USERNAME%:(OI)(CI)(R,W)" /grant:r "SYSTEM:(OI)(CI)(R,W)"

This restricts access to your user account and SYSTEM only. Other users on the machine can no longer read your API keys.

Verify the Install Succeeded

Verify installation
# Check openclaw version
openclaw --version

# Check gateway status
openclaw gateway status

# Run diagnostics
npx clawkit-doctor@latest

Did this guide solve your problem?

Need Help?

Try our automated tools to solve common issues instantly.