TraceResolve
MCP

npm: npm ERR! code EACCES syscall access '/usr/local/lib/node_modules'

npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/lib/node_modules npm ERR! errno -13 npm ERR! Error: EACCES: permission denied
Immediate Remediation
bash
npm config set prefix ~/.npm-global && echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc && source ~/.zshrc && npm install -g <package>
Root Cause Analysis

npm is attempting to write to the system-wide global node_modules directory (/usr/local/lib/node_modules) which requires root privileges, but the current user lacks write permissions to that location.

Verification & Guardrails

  • Ensure ~/.npm-global exists and is writable; create with mkdir -p ~/.npm-global if needed.
  • If using bash instead of zsh, update ~/.bashrc accordingly.
  • Verify the new prefix with 'npm config get prefix' after making changes.

Have a custom or uncategorized crash?

Run your trace through our in-memory client privacy sandbox for instant SRE remediation.

Open Diagnostic Studio