Node.js Version Too Old — Syntax Errors & tsx Crashes
// OpenClaw's current releases target Node.js 22.14 or newer (24 LTS is fine). Running on Ubuntu's default node 18/20, an old nvm alias, or the Node bundled with another tool causes immediate failures: SyntaxError on optional import syntax, native addons compiled for the wrong ABI, or tsx blowing up before the gateway starts. Symptoms look like random stack traces rather than a clear 'upgrade Node' message. This unofficial guide shows how to check `node -v` in the same context as your gateway (SSH vs systemd), install 22.14+ with nvm/fnm/NodeSource, and rebuild native modules so openclaw doctor and gateway install succeed on Mac Mini and Linux VPS alike.
🔍 Is This Your Issue?
✅ Fix 1 — Check Node Version Everywhere
# Interactive shell node -v which node npm -v # Same checks as gateway would see systemctl --user show-environment | grep -i path grep -E 'ExecStart|Environment' ~/.config/systemd/user/openclaw-gateway.service
# Quick floor check (bash)
NODE_MAJOR=$(node -p "process.versions.node.split('.')[0]")
NODE_MINOR=$(node -p "process.versions.node.split('.')[1]")
# Need: major >= 22 and (major > 22 or minor >= 14)
node -e "const [M,m]=process.versions.node.split('.').map(Number); if(M<22||(M===22&&m<14)) process.exit(1)"✅ Fix 2 — Install Node 22.14+ (nvm / fnm / NodeSource)
# nvm (common on Mac / Linux) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash source ~/.nvm/nvm.sh nvm install 22 nvm alias default 22 nvm use 22 node -v
# fnm alternative (fast, works well on VPS) curl -fsSL https://fnm.vercel.app/install | bash fnm install 22 fnm default 22 node -v # Ubuntu NodeSource (system-wide, no nvm) # curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - # sudo apt-get install -y nodejs
✅ Fix 3 — Rebuild Native Modules & Reinstall OpenClaw
# Rebuild global openclaw for new Node ABI npm rebuild -g openclaw # Or clean reinstall npm uninstall -g openclaw npm i -g openclaw@latest openclaw --version openclaw doctor
# Update systemd to use correct node path NODE_PATH=$(which node) # Edit openclaw-gateway.service ExecStart to use $NODE_PATH systemctl --user daemon-reload systemctl --user restart openclaw-gateway openclaw gateway status
Interactive SSH often loads nvm; systemd does not. Put nvm/fnm init in the service unit's Environment or use an absolute path to Node 22 in ExecStart. After upgrade, `which node` inside the service context must match `node -v` in your terminal.
- • Pin Node 22.14+ in .nvmrc or .node-version at the project root and on gateway hosts
- • Run `node -v` in CI, Docker base image, and systemd — not only on your laptop
- • After OS upgrades (apt upgrade nodejs), re-check version — distro packages lag upstream
- • Avoid mixing Homebrew node, nvm node, and /usr/bin/node on the same host
- • Document required Node version next to openclaw install steps in your runbook