#npm warnings not allowing me to install through terminal

1 messages · Page 1 of 1 (latest)

proper runeBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> âś… Mark Solution

charred tapirBOT
#

That warning is just the installer telling you “the npm global install step failed” — the real reason is a few lines above it (or in the npm debug log). On macOS the common causes are:

  • Node too old (OpenClaw needs Node 22+)
  • npm global prefix not writable / permission issues
  • PATH weirdness (brew Node vs nvm/fnm Node)
  • network/proxy/cert issues (less common)

1) Quick info to paste here

Run these and paste the output:

which node
node -v
which npm
npm -v
npm prefix -g
#

2) Re-run the installer in verbose mode (so we can see the real error)

curl -fsSL https://openclaw.ai/install.sh | bash -s -- --verbose --no-onboard

Then paste the chunk around the failure (and if it prints an npm log path like ~/.npm/_logs/...debug-0.log, paste the last ~50 lines of that log too).

3) Fast workaround (avoids global npm entirely)

If this is a permissions/prefix issue, the easiest “just make it work” path is the local-prefix installer:

curl -fsSL https://openclaw.ai/install-cli.sh | bash

Docs for the installer + flags: https://docs.openclaw.ai/install/installer
Node requirement / PATH troubleshooting: https://docs.openclaw.ai/install/node

#

Paste the outputs from (1) + the verbose failure from (2) and we can pinpoint it quickly.

echo kettle
#

Output 1:

/usr/local/bin/node v24.13.1 /usr/local/bin/npm 11.8.0 /usr/local avivassistant@Avivs-Mac-mini ~ %

Output 2 (Only the lines that actually said error):

npm error code EACCES
npm error syscall mkdir
npm error path /usr/local/lib/node_modules/openclaw
npm error errno -13
npm error Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/openclaw'
npm error at async mkdir (node:internal/fs/promises:856:10)
npm error at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:572:20
npm error at async Promise.allSettled (index 0)
npm error at async #reifyPackages (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:309:11)
npm error at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:121:5)
npm error at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150:5)
npm error at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:208:9)
npm error at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:67:5) {
npm error errno: -13,
npm error code: 'EACCES',
npm error syscall: 'mkdir',
npm error path: '/usr/local/lib/node_modules/openclaw'
npm error }
npm error
npm error The operation was rejected by your operating system.
npm error It is likely you do not have the permissions to access this file as the current user
npm error
npm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.
npm error A complete log of this run can be found in: /Users/avivassistant/.npm/_logs/2026-02-17T14_02_46_599Z-debug-0.log

charred tapirBOT
#

That’s a straight-up permissions issue: your npm prefix -g is /usr/local, so the installer is trying to write to:

/usr/local/lib/node_modules/openclaw → and macOS blocks that for non-root users (EACCES).

You’ve got 3 options:

Option A (recommended): local-prefix install (no sudo, no global npm)

curl -fsSL https://openclaw.ai/install-cli.sh | bash

This installs under ~/.openclaw and avoids /usr/local entirely.

Option B: keep global installs, but move npm’s global prefix to your home dir

mkdir -p "$HOME/.npm-global"
#
npm config set prefix "$HOME/.npm-global"

# add this to ~/.zshrc (or ~/.bashrc if you use bash)
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc

# reload shell config
source ~/.zshrc

Then rerun:

curl -fsSL https://openclaw.ai/install.sh | bash

Option C: sudo (works, but I don’t recommend it unless you know you want system-wide global npm)

echo kettle
#

what is global npm and why should I not have it

charred tapirBOT
#

“Global npm” usually refers to installing Node packages globally with npm -g (so the command is available anywhere), as opposed to installing them inside a specific project folder.

What “global” means in practice

  • npm install -g openclaw puts the openclaw executable into your npm global prefix (from npm prefix -g)
  • On your Mac, that prefix is /usr/local, so npm tries to write into /usr/local/lib/node_modules/...

Why people say “avoid global installs” (on macOS)

It’s not that global installs are inherently bad — it’s that they often end up in system-ish directories like /usr/local, which leads to:

  1. Permission errors (what you hit) unless you use sudo
  2. Risky sudo installs: sudo npm install -g ... runs install scripts as root, which is a security footgun and can mess up ownership/permissions later
  3. Harder to keep clean: global tools can conflict, get stale, or differ between shells/users

The good version of “global”

If you want global CLIs, it’s totally fine — just make the global prefix user-writable, e.g. ~/.npm-global, or use a version manager (nvm/fnm) that keeps globals inside your home directory.

Why I suggested the “local-prefix” installer

#

install-cli.sh installs under ~/.openclaw so:

  • no sudo
  • no /usr/local permission issues
  • less chance of breaking other things on your system

If you tell me which option you prefer (local-prefix vs “global but in home dir”), I can give you the exact minimal commands for that path.

echo kettle
#

When I ran option A, I got the same permissions error:

npm error code EACCES
npm error syscall mkdir
npm error path /usr/local/lib/node_modules/openclaw
npm error errno -13
npm error Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/openclaw'
npm error at async mkdir (node:internal/fs/promises:856:10)
npm error at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:572:20
npm error at async Promise.allSettled (index 0)
npm error at async #reifyPackages (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:309:11)
npm error at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:121:5)
npm error at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150:5)
npm error at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:208:9)
npm error at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:67:5) {
npm error errno: -13,
npm error code: 'EACCES',
npm error syscall: 'mkdir',
npm error path: '/usr/local/lib/node_modules/openclaw'
npm error }
npm error
npm error The operation was rejected by your operating system.
npm error It is likely you do not have the permissions to access this file as the current user
npm error
npm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.
npm error A complete log of this run can be found in: /Users/avivassistant/.npm/_logs/2026-02-17T14_02_46_599Z-debug-0.log

charred tapirBOT
#

Yeah — if install-cli.sh is being used correctly, it should install into ~/.openclaw/... and you should not see /usr/local/... in the npm error.

So if you’re still seeing:

mkdir '/usr/local/lib/node_modules/openclaw'

one of these is happening:

  1. you accidentally ran install.sh again (not install-cli.sh), or
  2. you have OPENCLAW_PREFIX set to /usr/local in your environment, so install-cli is installing there too.

Check if you have OpenClaw env vars set

Run:

env | grep -i openclaw

If you see OPENCLAW_PREFIX=/usr/local → that explains it.

#

“Known-good” way to run Option A (forces a home-directory prefix)

This avoids any confusion with pipes/env:

curl -fsSL https://openclaw.ai/install-cli.sh -o /tmp/openclaw-install-cli.sh
bash /tmp/openclaw-install-cli.sh --prefix "$HOME/.openclaw"
"$HOME/.openclaw/bin/openclaw" --version

If that works and you want openclaw on your PATH permanently:

echo 'export PATH="$HOME/.openclaw/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

If you paste one thing, paste this

  • output of env | grep -i openclaw
#
  • the exact command you ran for option A (copy/paste)

…and I can tell you immediately which of the two cases it is.

echo kettle
#

"env | grep -i openclaw" came back with nothing

charred tapirBOT
#

Good — that rules out a stray OPENCLAW_PREFIX.

If you really ran install-cli.sh, you should not be seeing /usr/local/... at all. That path strongly suggests you actually ran install.sh (or a plain npm i -g openclaw) again.

Two quick checks:

1) Paste the exact command you ran

Copy/paste it exactly (the whole line).

2) Verify which script you’re downloading

Run:

curl -fsSL https://openclaw.ai/install-cli.sh | head -n 3

It should start with something like:
# OpenClaw CLI installer (non-interactive, no onboarding)

#

“Force it” install (bypasses pipe confusion)

curl -fsSL https://openclaw.ai/install-cli.sh -o /tmp/openclaw-install-cli.sh
bash /tmp/openclaw-install-cli.sh --prefix "$HOME/.openclaw"

If that still errors, paste the new npm log path it prints (the timestamp/filename should change on each run).

echo kettle
#

I ran: curl -fsSL https://openclaw.ai/install-cli.sh -o /tmp/openclaw-install-cli.sh
bash /tmp/openclaw-install-cli.sh --prefix "$HOME/.openclaw"

and it came back with:

Installing OpenClaw (latest)...

changed 677 packages in 12s
OpenClaw installed (2026.2.15).

now what?

charred tapirBOT
#

Nice — you’re installed. Next steps:

1) Make openclaw available in new terminals

Right now it’s at ~/.openclaw/bin/openclaw. Add that to your PATH:

echo 'export PATH="$HOME/.openclaw/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Sanity check:

which openclaw
openclaw --version

2) Run onboarding + (optionally) install the daemon

#

This sets up auth, config, and can install the background Gateway service:

openclaw onboard --install-daemon

Then check it:

openclaw gateway status

3) Open the Control UI

openclaw dashboard

If you’re all set, please mark the solution (right-click the message that fixed it → Apps → ✅ Mark Solution) so it gets indexed for others.

echo kettle
#

when I ran: echo 'export PATH="$HOME/.openclaw/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

it came back with nothing, why?

charred tapirBOT
#

That’s expected.

  • echo 'export PATH=…' >> ~/.zshrc just appends a line to a file — it doesn’t print anything when it succeeds.
  • source ~/.zshrc just loads the file into your current shell — also usually prints nothing unless your .zshrc itself echoes something or errors.

To confirm it actually worked, run:

tail -n 3 ~/.zshrc
echo $PATH
which openclaw
openclaw --version

If which openclaw still shows “not found”, tell me:

#
echo $SHELL

and paste the output of which openclaw / any error text.

echo kettle
#

explain the daemon to me

charred tapirBOT
#

The “daemon” is just OpenClaw’s Gateway running as a background service so it stays on even when you close your terminal.

What it does

  • Runs the OpenClaw gateway server in the background
  • Keeps your channels / Control UI connection available
  • Starts automatically after reboot / login (depending on how it’s installed)

Why you’d want it

  • You don’t have to leave a terminal window open
  • More reliable for “always-on” use (Discord/Telegram/etc, scheduled crons, web UI)

What happens without it

You can still use OpenClaw, but you’d run it “foreground” style, e.g.:

openclaw gateway --port 18789

If you close that terminal, the gateway stops.