Claude Code 1.0.xInstall
Claude Code: npm EACCES permission denied on global install
npm error code EACCES — Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
- Affected versions
- 1.0.x
- Fixed in
- —
- Last verified
- Claude Code 1.0.x
Root cause
The global npm directory is root-owned, so installing without sudo fails — and installing with sudo creates a broken, root-owned setup.
How to reproduce
Run `npm install -g @anthropic-ai/claude-code` on a system npm; get EACCES.
Solutions (2)
Ordered by community votes. Always check the verified version before applying.
47
#1OfficialApplies to 1.0.x
Use the native installer (`curl -fsSL https://claude.ai/install.sh | bash`) instead of global npm, so it installs to a user-owned location.
Last verified: Claude Code 1.0.x · maintainer
29
#2Applies to 1.0.x
Or point npm's global prefix to a user-writable dir: `npm config set prefix ~/.npm-global` and add `~/.npm-global/bin` to PATH, then reinstall. Never use sudo.
Last verified: Claude Code 1.0.x · community