OpenClaw npm install failed? Here is what to do
You ran the one line from the install docs and got a wall of red instead of a working CLI:
npm install -g openclaw@latest
npm error code ENOENT
npm error syscall spawn git
npm error path git
npm error errno -2
npm error enoent An unknown git error occurred
That pattern is one of the most searched OpenClaw problems because the package pulls a large dependency tree, and minimal cloud images often ship without git or with an old Node. The errors look chaotic, but they cluster into a handful of causes with concrete fixes below.
| Error text | Cause | Fix |
|---|---|---|
spawn git ENOENT | npm needs git to fetch a dependency and the binary is missing | Install git |
Permission denied (publickey), code 128 | npm tried an SSH fetch with no GitHub key on the host | Retry, or prefer HTTPS |
ENOTEMPTY: directory not empty | A half renamed folder left behind by a failed install | Delete the leftover and retry |
EACCES on the global prefix | npm cannot write to the global directory | Use a user owned prefix |
| Failures that never mention Node | Node is older than the install target | Upgrade Node |
Start with the installer script
Before you hand tune npm on a blank server, the hosted script installs Node when needed and runs the global package install for you. On macOS, Linux, or WSL2:
curl -fsSL https://openclaw.ai/install.sh | bash
On native Windows PowerShell, use the script from the same install page. For a local prefix under ~/.openclaw without touching system Node, install-cli.sh is documented there as well. When you must use raw npm install -g (CI, custom images, air gapped mirrors), the sections below map directly to the error text.
spawn git ENOENT
This is the error in the block above. OpenClaw does not call git itself; a transitive dependency does. The WhatsApp stack @whiskeysockets/baileys resolves libsignal from a git+https:// URL, so npm shells out to the git binary to clone it. On a minimal Ubuntu or Debian VPS, git is often missing, and the install stops before OpenClaw's own scripts run. Maintainers discuss the failure mode in openclaw/openclaw#69117.
Install git, confirm it is on PATH, then retry.
On Ubuntu or Debian:
sudo apt update
sudo apt install git
On macOS, Xcode Command Line Tools (xcode-select --install) or Homebrew:
brew install git
On Windows, install Git for Windows and enable the option that adds Git to PATH during setup.
Verify and reinstall:
git --version
npm install -g openclaw@latest
If git --version works in a new terminal but npm still says ENOENT, check that the same shell user runs both commands and that which git (or where git on Windows) resolves inside non interactive SSH sessions and cron jobs.
Permission denied (publickey)
On hosts with git installed but no GitHub SSH key, npm may rewrite the dependency fetch to SSH:
npm error code 128
npm error An unknown git error occurred
npm error command git --no-replace-objects ls-remote ssh://git@github.com/whiskeysockets/libsignal-node.git
npm error git@github.com: Permission denied (publickey).
You do not need to configure GitHub SSH keys for a normal install. Retry npm install -g openclaw@latest once; npm frequently falls back to a registry published tarball on the second pass. If the error persists, set git to prefer HTTPS for GitHub (git config --global url."https://github.com/".insteadOf git@github.com:) and run the install again.
Upstream moved toward registry hosted libsignal in openclaw/openclaw#12841; until your installed package version includes that change, git on PATH remains the practical requirement on clean machines.
ENOTEMPTY
A failed global install can leave a half renamed directory inside global node_modules:
npm error ENOTEMPTY: directory not empty, rename '.../node_modules/openclaw' -> '.../node_modules/.openclaw-ScBINLhf'
Remove the folder named in your error (the hash suffix changes each run), then install again:
rm -rf "$(npm root -g)/.openclaw-ScBINLhf"
npm install -g openclaw@latest
Substitute the exact .openclaw-* path from your log. If ENOTEMPTY repeats, remove any other .openclaw-* entries sitting beside openclaw under npm root -g, then run a single clean install.
EACCES
When npm cannot write to the default global directory, you see:
npm error code EACCES
npm error syscall mkdir
npm error path /usr/local/lib/node_modules/openclaw
Using sudo npm install -g openclaw often completes the install but creates root owned files under node_modules, which breaks later plugin loads when the gateway runs as your normal user (openclaw/openclaw#87947). The npm global permissions guide recommends a user owned prefix instead of sudo:
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
npm install -g openclaw@latest
On bash, append the same export line to ~/.bashrc. Alternatively install Node through nvm so global packages live entirely under your home directory. After changing prefix or Node layout, run npm prefix -g and confirm $(npm prefix -g)/bin appears in echo "$PATH" per the install doc troubleshooting section.
Node version too old
OpenClaw targets a current Node runtime: Node 24 recommended, or Node 22.19+. Below that, installs fail or the CLI breaks in ways that do not mention Node in the first line.
Check and upgrade:
node -v
Use the Node.js download page or nvm:
nvm install 24
nvm use 24
npm install -g openclaw@latest
On macOS with Homebrew, brew install node@22 or the current LTS formula from brew.sh works if you prefer system packages over nvm. Reinstall OpenClaw after Node changes so native addons match the active runtime.
spawn npm ENOENT
A different ENOENT appears when OpenClaw is present but a subprocess cannot find npm:
Failed to start CLI: Error: spawn npm ENOENT
ENOENT here means the executable was not found. Run:
node --version
npm --version
which npm
If any command is missing, install Node for that environment. If Node works but which npm is empty, add $(npm prefix -g)/bin to PATH in ~/.zshrc or ~/.bashrc as shown in the install troubleshooting section, open a new terminal, and run openclaw doctor. Inside Docker, Node and npm must exist in the image the container runs, not only on the host.
pnpm and bun installs
If you use pnpm globally, the install doc shows:
pnpm add -g openclaw@latest
pnpm approve-builds -g
pnpm requires approving packages with install scripts. Bun supports bun add -g openclaw@latest; the gateway runtime still expects Node for daemon style deployments.
Verify the install
openclaw --version
openclaw doctor
openclaw gateway status
openclaw doctor flags missing binaries, broken config, and common PATH mistakes. If the CLI is missing after a reported success, compare npm prefix -g with your shell PATH before you chase gateway errors.
The managed option
The fixes above are the real fixes: git on PATH, Node 22.19+, a user owned global prefix, and clearing stale .openclaw-* folders after a partial install. Many people hitting spawn git ENOENT are on a fresh VPS they created only to run an agent, and they wanted the agent rather than an afternoon reconciling Node layouts.
Operator.io runs OpenClaw as a managed service, so there is no global npm install, no git package to add on the image, and no daemon permission puzzle after sudo npm. You sign in and attach Telegram or Discord from the dashboard. See pricing to try that path, or work through the commands here and keep the gateway on your own machine.
Frequently asked questions
Why does npm install fail when installing OpenClaw?
+
Most failures are a missing git binary, Node older than 22.19, or npm lacking write access to the global prefix. The common spawn git ENOENT happens because a WhatsApp related dependency resolves libsignal from a git URL and npm must run git. Install git, confirm with git --version, then run npm install -g openclaw@latest again. On a fresh VPS, also check node -v against the install requirements.
How do I fix "spawn git ENOENT" when installing OpenClaw?
+
Install git for your OS, add it to PATH on Windows, then retry. On Debian or Ubuntu use sudo apt update && sudo apt install git. On macOS use Xcode Command Line Tools or brew install git. On Windows install Git for Windows and enable PATH. Run git --version, then npm install -g openclaw@latest. If you see Permission denied (publickey) for a GitHub SSH URL, retry once; npm often falls back to a registry tarball on the second attempt.
What does ENOTEMPTY mean on a retry?
+
A failed global install can leave a half renamed folder such as .openclaw-<hash> inside global node_modules. The next install hits ENOTEMPTY: directory not empty when npm tries to rename into that path. Delete the exact directory named in your error output, then run npm install -g openclaw@latest once more. Clear any other .openclaw-* leftovers in the same directory if the error repeats.
What Node version does OpenClaw need?
+
The current install docs recommend Node 24 or Node 22.19 and above. Older Node versions produce install or runtime errors that look unrelated to Node. Upgrade via the official installer script, nvm, or your OS package manager, verify with node -v, then reinstall. After install, run openclaw doctor to surface missing tools and config problems.
Keep reading
How to set up OpenClaw on Discord, step by step
Create a bot in the Discord Developer Portal, turn on the Message Content Intent, invite it with the right scopes, drop the token and application ID into your config, then approve the DM pairing code, including the intent toggle that leaves most bots online but silent.
May 31, 2026Debugging the OpenAI Codex backend in OpenClaw
Running OpenClaw on your ChatGPT Codex subscription is popular and currently the most bug-prone backend. Turn completion stalls, Cloudflare 403s misread as auth failures, OAuth 401s after a clean login, and timeouts waiting for turn/completed are all live. Here is what is going on.
May 30, 2026Debugging OpenClaw on Discord: application IDs, intents, and double messages
Most OpenClaw Discord problems are one of a few things: the app ID never resolves, the bot cannot read messages because the intent is off, the gateway hangs at awaiting readiness, or replies arrive twice. Here is how to tell which and fix it.
May 30, 2026