From 351c73be01686800bd2a71969eea35b462dee7d0 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 22 Jan 2026 04:26:18 +0000 Subject: [PATCH] docs: fix npm prefix guidance --- docs/install/index.md | 9 ++++++--- docs/install/node.md | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/docs/install/index.md b/docs/install/index.md index 467ea6bf0..57b09c4cf 100644 --- a/docs/install/index.md +++ b/docs/install/index.md @@ -155,18 +155,21 @@ Quick diagnosis: ```bash node -v npm -v -npm bin -g +npm prefix -g echo "$PATH" ``` -If the output of `npm bin -g` is **not** present inside `echo "$PATH"`, your shell can’t find global npm binaries (including `clawdbot`). +If `$(npm prefix -g)/bin` (macOS/Linux) or `$(npm prefix -g)` (Windows) is **not** present inside `echo "$PATH"`, your shell can’t find global npm binaries (including `clawdbot`). Fix: add it to your shell startup file (zsh: `~/.zshrc`, bash: `~/.bashrc`): ```bash -export PATH="/path/from/npm/bin/-g:$PATH" +# macOS / Linux +export PATH="$(npm prefix -g)/bin:$PATH" ``` +On Windows, add the output of `npm prefix -g` to your PATH. + Then open a new terminal (or `rehash` in zsh / `hash -r` in bash). ## Update / uninstall diff --git a/docs/install/node.md b/docs/install/node.md index 8987a859b..6a622e198 100644 --- a/docs/install/node.md +++ b/docs/install/node.md @@ -19,33 +19,36 @@ Run: ```bash node -v npm -v -npm bin -g +npm prefix -g echo "$PATH" ``` -If the output of `npm bin -g` is **not** present inside `echo "$PATH"`, your shell can’t find global npm binaries (including `clawdbot`). +If `$(npm prefix -g)/bin` (macOS/Linux) or `$(npm prefix -g)` (Windows) is **not** present inside `echo "$PATH"`, your shell can’t find global npm binaries (including `clawdbot`). ## Fix: put npm’s global bin dir on PATH -1) Find your global bin directory: +1) Find your global npm prefix: ```bash -npm bin -g +npm prefix -g ``` -2) Add it to your shell startup file: +2) Add the global npm bin directory to your shell startup file: - zsh: `~/.zshrc` - bash: `~/.bashrc` -Example (replace the path with your `npm bin -g` output): +Example (replace the path with your `npm prefix -g` output): ```bash -export PATH="/path/from/npm/bin/-g:$PATH" +# macOS / Linux +export PATH="/path/from/npm/prefix/bin:$PATH" ``` Then open a **new terminal** (or run `rehash` in zsh / `hash -r` in bash). +On Windows, add the output of `npm prefix -g` to your PATH. + ## Fix: avoid `sudo npm install -g` / permission errors (Linux) If `npm install -g ...` fails with `EACCES`, switch npm’s global prefix to a user-writable directory: @@ -63,7 +66,7 @@ Persist the `export PATH=...` line in your shell startup file. You’ll have the fewest surprises if Node/npm are installed in a way that: - keeps Node updated (22+) -- makes `npm bin -g` stable and on PATH in new shells +- makes the global npm bin dir stable and on PATH in new shells Common choices: