Getting Node.js Ready for OpenClaw
I’ve lost count of how many times I’ve tried to run a new tool only to have it crash because my environment was out of date. It is frustrating when you just want to get to work but end up fighting with your terminal instead. Making sure your runtime is solid before you start saves a lot of headaches later.
OpenClaw needs a specific environment to run correctly. I will show you how to get Node.js configured so everything works the first time.
What You’ll Need
Section titled “What You’ll Need”- Node.js 22 or newer: This is a hard requirement.
- A terminal: You will need this to run version checks and install commands.
Quick Start
Section titled “Quick Start”First, check what you already have. Open your terminal and run:
node -vIf the output says v22.x.x or higher, you are ready. If you don’t have it or your version is too old, follow the steps for your system below.
Install Node
Section titled “Install Node”macOS I recommend using Homebrew:
brew install nodeYou can also get the installer directly from nodejs.org.
Linux For Ubuntu or Debian:
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -sudo apt-get install -y nodejsFor Fedora or RHEL:
sudo dnf install nodejsWindows I recommend using winget:
winget install OpenJS.NodeJS.LTSOr use Chocolatey:
choco install nodejs-ltsUsing a Version Manager
Section titled “Using a Version Manager”If you need to switch between versions for different projects, you can use a manager like fnm or nvm. If you use fnm, you can set up Node 22 quickly:
fnm install 22fnm use 22Make sure your version manager is initialized in your shell startup file (~/.zshrc or ~/.bashrc). If it isn’t, your terminal might not find openclaw later because the PATH won’t be updated.
Troubleshooting
Section titled “Troubleshooting”openclaw: command not found
Section titled “openclaw: command not found”This usually happens when your terminal doesn’t know where npm’s global binaries are stored. Here is how to fix it:
- Find your global prefix:
Terminal window npm prefix -g - Check your PATH:
Terminal window echo "$PATH" - Update your startup file:
On macOS or Linux, add this to your
~/.zshrcor~/.bashrc:On Windows, add the output from step 1 to your system PATH via Environment Variables in Settings.Terminal window export PATH="$(npm prefix -g)/bin:$PATH"
Permission errors on npm install -g
Section titled “Permission errors on npm install -g”If you see EACCES errors on Linux, you should change npm’s global prefix to a directory you own:
mkdir -p "$HOME/.npm-global"npm config set prefix "$HOME/.npm-global"export PATH="$HOME/.npm-global/bin:$PATH"Add that last export line to your ~/.bashrc to keep the fix active.
If you run into other weird environment issues, you can ask the AI Setup Assistant for help.
What’s Next
Section titled “What’s Next”OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.