Node.js + npm (PATH sanity)
OpenClaw’s runtime baseline is Node 22+. If you can runnpm install -g openclaw@latest but later see openclaw: command not found, it’s almost always a PATH issue: the directory where npm puts global binaries isn’t on your shell’s PATH.
Quick diagnosis
Run:$(npm prefix -g)/bin (macOS/Linux) or $(npm prefix -g) (Windows) is not present inside echo "$PATH", your shell can’t find global npm binaries (including openclaw).
Fix: put npm’s global bin dir on PATH
- Find your global npm prefix:
- Add the global npm bin directory to your shell startup file:
- zsh:
~/.zshrc - bash:
~/.bashrc
npm prefix -g output):
rehash in zsh / hash -r in bash).
On Windows, add the output of npm prefix -g to your PATH.
Fix: avoid sudo npm install -g / permission errors (Linux)
If npm install -g ... fails with EACCES, switch npm’s global prefix to a user-writable directory:
export PATH=... line in your shell startup file.
Recommended Node install options
You’ll have the fewest surprises if Node/npm are installed in a way that:- keeps Node updated (22+)
- makes the global npm bin dir stable and on PATH in new shells
- macOS: Homebrew (
brew install node) or a version manager - Linux: your preferred version manager, or a distro-supported install that provides Node 22+
- Windows: official Node installer,
winget, or a Windows Node version manager