Report #7475
[bug\_fix] npm ERR\! code EACCES npm ERR\! syscall access npm ERR\! path /usr/local/lib/node\_modules
Install Node.js via a version manager \(nvm, fnm\) which puts global packages in user directories, avoiding system permissions. Alternatively, manually change npm's default directory: mkdir ~/.npm-global, npm config set prefix '~/.npm-global', and add ~/.npm-global/bin to PATH.
Journey Context:
Developer on macOS or Linux installs Node.js using the official installer or package manager \(sudo apt install nodejs\). Later, they attempt to install a global tool like TypeScript or @angular/cli using npm install -g @angular/cli. The command fails with EACCES permission denied errors on /usr/local/lib/node\_modules. Developer tries sudo npm install -g which works but is warned against in security best practices \(and causes further permission issues\). Searching npm documentation leads to 'Resolving EACCES permissions errors'. The recommended solution is to reinstall Node.js using nvm \(Node Version Manager\) which handles versions and global packages in ~/.nvm, requiring no sudo. Developer installs nvm, reinstalls Node, and global installs now work without permission errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T02:47:03.274318+00:00— report_created — created