OpenClaw: Permission Denied During Install
Resolve EACCES and permission-denied errors by using a user-owned package prefix and matching the OpenClaw service user.
npm, pnpm, the installer, or OpenClaw reports EACCES, operation not permitted, or a directory that the current user cannot write.
Do not solve a global package permission error by making the entire Node installation or OpenClaw state directory world-writable. Use an install prefix owned by the user who runs OpenClaw.
Find the failing path
Read the first EACCES or permission-denied line. Then inspect the package prefix and current identity:
whoami
npm prefix -g
If the prefix belongs to root or another account, either use a Node version manager or move npm’s global prefix to a user-owned directory as described in the official Node guide.
Keep one service identity
Install and run the Gateway as the same normal user. A CLI installed with sudo and a Gateway running as a normal user can produce a mixed set of state, logs, and global packages.
If the error points to an existing OpenClaw file, inspect its owner before changing anything. Correct only the specific path that was accidentally created by the wrong user; do not recursively change ownership of a home directory or system package tree.
Retry from a fresh shell
After updating the global prefix or version-manager setup, open a new terminal and confirm:
node --version
npm prefix -g
openclaw --version
Expected result
The global package prefix is writable by the intended OpenClaw user, the CLI runs without elevated privileges, and no new root-owned files appear in the OpenClaw state or workspace.
Source notes
Technical facts on this page were checked against primary sources.