ClawKit Logo
ClawKitReliability Toolkit

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.

What the Error Looks Like

You'll see one or more of these messages during npm install:

npm error syscall spawn git
npm error code ENOENT
npm error errno -4058
npm error enoent Error: spawn git ENOENT
'git' is not recognized as an internal or external command

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

# Step 1: Install Git
# Windows:
winget install Git.Git
# macOS:
xcode-select --install
# Ubuntu / Debian:
sudo apt install git
# Step 2: Close and reopen your terminal
# Step 3: Verify it works
git --version
# Step 4: Retry the install
npm install -g openclaw

You must close and reopen your terminal after installing Git, otherwise the PATH won't be updated.

Windows: Install Git

Windows 10 / 11

Option A: winget (Recommended)

The fastest way on modern Windows. Open PowerShell or Command Prompt:

Windows
winget install Git.Git

Close and reopen your terminal, then verify:

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

macOS

Option A: Xcode Command Line Tools (No Homebrew needed)

macOS
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

Homebrew
brew install git

Linux: Install Git

Linux
Linux
# 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:

Verify & Retry
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:

1

Close and reopen your terminal

The simplest fix. New terminal sessions load the updated PATH. This works on all operating systems.

2

Windows: Restart your computer

Some Windows installers only update the PATH on reboot. If closing the terminal doesn't work, try a full restart.

3

macOS/Linux: Source your profile

Run "source ~/.bashrc" or "source ~/.zshrc" to reload PATH without closing the terminal.

4

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:

Manual PATH Fix
# 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

# Runs without needing Git installed
npx clawkit-doctor@latest

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.

Did this guide solve your problem?

Need Help?

Try our automated tools to solve common issues instantly.