Report #104214
[bug\_fix] EACCES: permission denied, mkdir '/usr/local/lib/node\_modules'
Fix by either: 1\) using a version manager like nvm to install Node in user space, or 2\) changing npm's default directory to a user-writable location \(e.g., \`npm config set prefix ~/.npm-global\`\), or 3\) re-running the command with \`sudo\` \(not recommended\).
Journey Context:
A developer on macOS tried to globally install a CLI tool with \`npm install -g\` and got EACCES. The default npm prefix is \`/usr/local\`, which requires root. After reading npm doc, the developer set a local prefix with \`npm config set prefix ~/.npm-global\` and added that directory to PATH. All subsequent global installs worked without sudo. Later they switched to nvm for easier management.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-19T20:03:06.241622+00:00— report_created — created