solution install high linux macos
npm install -g fails with EACCES / permission denied
Fix global install permission errors on Linux/macOS by switching npm's global prefix to a user-writable directory (avoid sudo).
By CoClaw Team •
Error signatures: EACCES | permission denied | mkdir
Symptoms
npm install -g openclaw@latestfails withEACCES/permission denied.- Errors mention
mkdirin a root-owned directory (common on Linux).
Cause
Your npm global prefix points to a directory that requires root permissions, so global installs fail unless you use sudo (not recommended).
Fix
Switch npm’s global prefix to a user-writable directory:
mkdir -p "$HOME/.npm-global"
npm config set prefix "$HOME/.npm-global"
export PATH="$HOME/.npm-global/bin:$PATH"
Persist the export PATH=... line in your shell startup file (zsh: ~/.zshrc, bash: ~/.bashrc), then open a new terminal.
Now retry:
npm install -g openclaw@latest
Verify
command -v openclaw
openclaw --help
Related
- If you then get
openclaw: command not found, your PATH still doesn’t include the global bin dir (see the related install/PATH article).