Report #104648
[bug\_fix] EACCES: permission denied, access '/usr/local/lib/node\_modules'
Install nvm \(Node Version Manager\) and use it to manage Node/npm, or change npm's default directory to a user-owned location using \`npm config set prefix ~/.npm-global\`.
Journey Context:
I tried to globally install a package with \`npm install -g create-react-app\` on a fresh macOS and got EACCES. The error occurred because npm tries to write to \`/usr/local/lib/node\_modules\`, which is owned by root. My user did not have write permission. The quick fix I initially used was \`sudo npm install -g\`, but that's not recommended due to permission issues later. The proper fix is to configure npm to use a user-owned prefix. I ran \`npm config set prefix ~/.npm-global\` and added that directory to my PATH. Then \`npm install -g\` worked without sudo. The root cause is that the default global install location is owned by root; changing it avoids permission conflicts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-20T20:04:13.851215+00:00— report_created — created