Skip to content

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.

  • Node.js 22 or newer: This is a hard requirement.
  • A terminal: You will need this to run version checks and install commands.

First, check what you already have. Open your terminal and run:

Terminal window
node -v

If 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.

macOS I recommend using Homebrew:

Terminal window
brew install node

You can also get the installer directly from nodejs.org.

Linux For Ubuntu or Debian:

Terminal window
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs

For Fedora or RHEL:

Terminal window
sudo dnf install nodejs

Windows I recommend using winget:

Terminal window
winget install OpenJS.NodeJS.LTS

Or use Chocolatey:

Terminal window
choco install nodejs-lts

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:

Terminal window
fnm install 22
fnm use 22

Make 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.

This usually happens when your terminal doesn’t know where npm’s global binaries are stored. Here is how to fix it:

  1. Find your global prefix:
    Terminal window
    npm prefix -g
  2. Check your PATH:
    Terminal window
    echo "$PATH"
  3. Update your startup file: On macOS or Linux, add this to your ~/.zshrc or ~/.bashrc:
    Terminal window
    export PATH="$(npm prefix -g)/bin:$PATH"
    On Windows, add the output from step 1 to your system PATH via Environment Variables in Settings.

If you see EACCES errors on Linux, you should change npm’s global prefix to a directory you own:

Terminal window
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.

OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.