← Back to library

安装后命令找不到:`openclaw is not discoverable` 一次性排障流程

问题/场景:npm 安装成功但 shell 找不到 openclaw,常伴随 EACCES/旧 Node/TTY 报错。前置条件:可访问终端并修改 shell 配置。实施步骤:1) `npm prefix -g` 定位全局前缀;2) 把 `<prefix>/bin` 加入 PATH 并 reload shell;3) 如有 EACCES,改 user-owned prefix 后重装;4) 校验 Node>=22;5) 无 TTY 环境用 `openclaw onboard --non-interactive --accept-risk`。关键命令已给出。验证方法:`openclaw --version` 与 `openclaw gateway status` 正常。风险与边界:不同 shell 文件路径不同;容器/CI 下 TTY 行为需验证。来源归因:Reddit 教程贴 + 官方安装文档。

REDDITDiscovered 2026-03-01Author u/kenanbek
Prerequisites
  • Terminal access with permission to edit shell rc files.
  • npm/node are installed and command outputs are accessible.
Steps
  1. Run `npm prefix -g` and append `<prefix>/bin` to PATH in `.bashrc` or `.zshrc`.
  2. Reload shell (`source ~/.bashrc` or reopen terminal) and check `openclaw --version`.
  3. If EACCES appears, switch npm global prefix to a user-owned directory and reinstall without sudo.
  4. Verify Node runtime is 22+ using `node --version`.
  5. In CI/Docker without TTY, use non-interactive onboard command.
Commands
npm prefix -g
node --version
openclaw --version
openclaw onboard --non-interactive --accept-risk
openclaw doctor --fix
Verify

`openclaw --version` works in a fresh shell and gateway starts without path/permission errors.

Caveats
  • Shell profile filename differs by environment (bash/zsh/fish)(需验证).
  • Do not paste tokens or secrets when sharing install logs publicly.
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post