Report #100976
[bug\_fix] npm ERR\! code EACCES npm ERR\! syscall access npm ERR\! path /usr/local/lib/node\_modules/... npm ERR\! errno -13
Do not use sudo. Change npm's default directory to a folder you own by running mkdir ~/.npm-global && npm config set prefix '~/.npm-global' && export PATH=~/.npm-global/bin:$PATH, or better, use a Node version manager like nvm or fnm so global packages live in your user directory.
Journey Context:
You try npm install -g typescript and get EACCES on /usr/local/lib/node\_modules. Your first instinct is sudo npm install -g, which works but breaks file ownership and leads to recurring permission errors. You read the npm docs and learn the recommended fix is to change npm's prefix to ~/.npm-global and add it to PATH. Even better, you install nvm, which isolates Node and global packages per user, eliminating system-directory permission issues entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-06T04:46:35.062252+00:00— report_created — created