#openclaw command not found
1 messages · Page 1 of 1 (latest)
On Ubuntu this almost always means the global npm “bin” directory dropped out of your $PATH, or you switched Node installs (e.g. via nvm) so the old global install isn’t on the new Node anymore.
Do this and paste the output here:
command -v openclaw || true
node -v
npm -v
npm prefix -g
echo "$PATH"
ls -la "$(npm prefix -g)/bin" | grep -i openclaw || true
If $(npm prefix -g)/bin is not in your PATH
Add it (then open a new terminal, or run hash -r):
echo 'export PATH="$(npm prefix -g)/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
hash -r
If openclaw simply isn’t installed in that prefix
Reinstall it:
npm install -g openclaw@latest
hash -r
openclaw --version
Docs reference (this exact “openclaw not found” section): https://docs.openclaw.ai/install#troubleshooting-openclaw-not-found
Once the command works again, the next two useful checks are:
openclaw status --all
openclaw gateway status
Your $PATH is fine (it already contains ~/.nvm/.../bin and ~/.openclaw/bin). The key clue is this line:
.../bin/.openclaw-DLDCAmIE -> ../lib/node_modules/openclaw/openclaw.mjs
So the package bits exist, but there’s no actual openclaw executable in your PATH — only that hidden shim. This commonly happens with nvm when you change/upgrade Node: global installs are per-node-version, and you end up with a half/missing link.
Try this (safe, just reinstalls the CLI for your current Node v22.21.1):
npm uninstall -g openclaw || true
npm install -g openclaw@latest
hash -r
command -v openclaw
openclaw --version
If command -v openclaw is still empty, paste:
ls -la "$(npm prefix -g)/bin" | grep -i openclaw || true
ls -la ~/.openclaw/bin | head -50
npm config get bin-links
Docs reference (same issue): https://docs.openclaw.ai/install#troubleshooting-openclaw-not-found
this will not remove my memory, config etc, right?
Yep — npm uninstall -g openclaw / npm install -g openclaw@latest only removes/reinstalls the CLI package in your current Node (nvm) global node_modules.
It does not delete your OpenClaw data (config, sessions, “memory” files, workspaces), because that stuff lives in your home/state dirs (typically under ~/.openclaw/, unless you set OPENCLAW_HOME / OPENCLAW_STATE_DIR / OPENCLAW_CONFIG_PATH).
If you want a belt-and-suspenders backup before reinstalling, you can do:
cp -a ~/.openclaw ~/.openclaw.bak.$(date +%Y%m%d-%H%M%S) 2>/dev/null || true
The only commands that intentionally remove state are the explicit uninstall/reset flows — not a global npm reinstall.
That error is npm tripping over a leftover temp dir from a previous (possibly interrupted) install/uninstall.
Specifically, it’s trying to rename:
.../lib/node_modules/openclaw → .../lib/node_modules/.openclaw-GyGpKxw8
…but that .openclaw-GyGpKxw8 directory already exists and isn’t empty, so npm bails with ENOTEMPTY.
Fix (safe version = rename the leftover temp dir out of the way):
cd /home/vatsal/.nvm/versions/node/v22.21.1/lib/node_modules
ls -la | egrep 'openclaw|\.openclaw-'
# move the leftover temp dir out of the way (keeps a backup)
mv .openclaw-GyGpKxw8 .openclaw-GyGpKxw8.bak.$(date +%s) 2>/dev/null || true
# now retry
npm uninstall -g openclaw || true
npm install -g openclaw@latest
hash -r
openclaw --version
If you see multiple .openclaw-* dirs in that folder, move them aside the same way.
And yeah: this is only touching the global npm install dir under nvm — it will not remove your OpenClaw config/memory/state in ~/.openclaw/ (unless you explicitly delete that).
If it still errors after that, paste the output of:
ls -la /home/vatsal/.nvm/versions/node/v22.21.1/lib/node_modules | egrep 'openclaw|\.openclaw-'
You’re basically halfway there — the only thing you’ve done so far is confirm the stuck temp dir exists. Next step is to move it out of the way, then retry the install.
Run exactly this:
cd /home/vatsal/.nvm/versions/node/v22.21.1/lib/node_modules
# move the leftover temp dir out of the way (backup, not delete)
mv .openclaw-GyGpKxw8 .openclaw-GyGpKxw8.bak.$(date +%s)
# now retry reinstall
npm uninstall -g openclaw || true
npm install -g openclaw@latest
hash -r
command -v openclaw
openclaw --version
If it still errors
Then do the same “move aside” trick for the actual openclaw folder too (also non-destructive) and reinstall:
cd /home/vatsal/.nvm/versions/node/v22.21.1/lib/node_modules
mv openclaw openclaw.bak.$(date +%s)
npm install -g openclaw@latest
Once openclaw --version works, next check is:
openclaw status --all
openclaw gateway status
this worked. Can you gimme a summary of how we debugged and fixed this?
Yep — here’s what happened + what fixed it:
Symptom
After updating, your shell said openclaw: command not found.
What we checked
- Is this a PATH problem or an install problem?
You ran:
node -v,npm -vnpm prefix -g- checked
$PATH - looked in
$(npm prefix -g)/bin
Result: your PATH was fine, and the global npm prefix was inside nvm (~/.nvm/...). But the expected openclaw executable wasn’t present/working.
- Reinstall the global CLI for the current nvm Node version
Since nvm isolates global installs per Node version, we tried:
npm uninstall -g openclawnpm install -g openclaw@latest
The actual failure
That reinstall failed with:
ENOTEMPTY: directory not empty, rename .../openclaw -> .../.openclaw-<random>
Meaning: npm was trying to uninstall by renaming the old folder to a temporary hidden folder, but a leftover temp directory from a previous attempt already existed and wasn’t empty (in your case: .openclaw-GyGpKxw8).
The fix
We went to the global module directory:
/home/vatsal/.nvm/versions/node/v22.21.1/lib/node_modules
Confirmed the leftover temp dir existed, then moved it aside (non-destructive backup rename), and retried the uninstall/install. After that, npm could complete cleanly, and openclaw was back.
Root cause (in one line)
A stale npm temp dir inside your nvm global node_modules blocked uninstall/reinstall; moving it away let npm finish and restore the CLI symlink/binary.
If this fixed it, please right-click the solution message → Apps → ✅ Mark Solution (Answer Overflow indexes it and it helps the next person).
okay it restarted and all but is stuck on typing
“Stuck on typing” = the Discord bot shows the typing indicator forever, but never sends a message back?
If so, that usually means the Gateway is up, but something downstream is failing (model/auth, Discord send perms, or an internal error). Let’s grab the quick read-only diagnostics.
Run these and paste the output in one message (it’s designed to be share-safe; tokens get redacted):
openclaw --version
openclaw status --all
openclaw gateway status
openclaw models status
If those don’t make the issue obvious, grab the live log while you trigger the “typing” again:
openclaw logs --follow
…and copy the first error stack / repeating lines you see right when it gets stuck.
Docs reference for this exact debug loop: https://docs.openclaw.ai/help/faq.md#first-60-seconds-if-somethings-broken
okay changing the model fixed it
Nice — that pattern fits: “stuck on typing” often means the gateway/channel is fine but the model/provider call is failing or hanging, so Discord never gets a final response.
If you can, drop 2 quick details so we can pattern-match it for others:
- what model you were on before → what you switched to
- whether
openclaw models statusshowed anything weird
And if this thread is resolved, please right-click the message that fixed it → Apps → ✅ Mark Solution so Answer Overflow indexes it.
That gateway status output is actually useful: the daemon is running, but your systemd user service is still wired to an nvm-managed Node path, which can get flaky after upgrades (and OpenClaw explicitly warns about it).
Two things to do next (in this order):
1) When it’s “stuck” again, grab the error line from logs
Run this, then send a message to the bot to reproduce the “typing forever”, then paste the first error you see:
openclaw logs --follow
If that doesn’t show anything, paste the last ~200 lines of the file log it mentioned:
tail -n 200 /tmp/openclaw/openclaw-2026-03-02.log
Also paste:
openclaw models status
(“typing forever” is very often a model/provider failure or hang, and models status + the log usually makes it obvious: 429s, auth, tool schema errors, etc.)
2) Fix the service wiring (the nvm warning)
Run the repair and restart:
openclaw doctor --repair
openclaw gateway restart
This should rewrite the systemd service to a more robust/standard setup so it doesn’t regress after Node/OpenClaw updates.