Fix "spawn git ENOENT" Error
Common Installation Error
This error means Git is not installed on your system or is not in your PATH. OpenClaw's npm packages require Git to resolve dependencies. The fix takes under 60 seconds.
The spawn git ENOENT error occurs when npm tries to run git but can't find it. "ENOENT" stands for "Error NO ENTry" — the system cannot locate the git executable.
Next Step
Fix now, then reduce repeat incidents
If this issue keeps coming back, validate your setup in Doctor first, then harden your config.
Jump to Your OS
What the Error Looks Like
You'll see one or more of these messages during npm install:
The error code -4058 on Windows (or -2 on macOS/Linux) both mean the same thing: file not found.
Quick Fix (60 Seconds)
Install Git + Retry
You must close and reopen your terminal after installing Git, otherwise the PATH won't be updated.
Windows: Install Git
Option A: winget (Recommended)
The fastest way on modern Windows. Open PowerShell or Command Prompt:
winget install Git.Git
Close and reopen your terminal, then verify:
git --version # Expected: git version 2.x.x
Option B: Manual Download
If winget is not available, download the installer from git-scm.com/download/win. During installation, make sure to select "Git from the command line and also from 3rd-party software" — this adds Git to your PATH.
Common mistake: choosing "Use Git from Git Bash only" during installation. This does NOT add Git to the system PATH, so npm still can't find it.
macOS: Install Git
Option A: Xcode Command Line Tools (No Homebrew needed)
xcode-select --install
A system dialog will appear. Click Install, then wait for it to complete (~2 minutes). This installs Git along with other developer tools.
Option B: Homebrew
brew install git
Linux: Install Git
# Ubuntu / Debian sudo apt update && sudo apt install git # Fedora sudo dnf install git # Arch sudo pacman -S git
Verify Git Is Working
After installation, close and reopen your terminal, then run:
git --version # Expected output: git version 2.x.x # If it works, retry your install npm install -g openclaw
If git --version prints a version number, you're good. Retry the npm install and the ENOENT error should be gone.
PATH Not Updated After Install
If you installed Git but still get the error, your terminal session hasn't picked up the new PATH. Try these:
Close and reopen your terminal
The simplest fix. New terminal sessions load the updated PATH. This works on all operating systems.
Windows: Restart your computer
Some Windows installers only update the PATH on reboot. If closing the terminal doesn't work, try a full restart.
macOS/Linux: Source your profile
Run "source ~/.bashrc" or "source ~/.zshrc" to reload PATH without closing the terminal.
Check Git location manually
Run "where git" (Windows) or "which git" (macOS/Linux). If nothing prints, Git is not in your PATH.
Windows: Manually Add Git to PATH
If Git is installed but not in PATH, add it manually:
# Check if Git is installed at the default location dir "C:\Program Files\Git\cmd\git.exe" # If it exists, add to PATH for current session set PATH=%PATH%;C:\Program Files\Git\cmd # Verify git --version
To make it permanent, add C:\Program Files\Git\cmd to your system PATH via System Properties > Environment Variables.
Auto-Diagnose with Doctor
Run the Doctor
The Doctor checks your entire environment — Node.js, Git, permissions, config files — and reports exactly what's missing.
Or use the web-based Error Doctor to paste the full error and get matched fixes instantly.
Seeing Other Errors Too?
Installation issues often come with these related problems:
Did this guide solve your problem?