EACCES: permission denied
npm tried to write to a directory your current user doesn't have write access to — almost always during a global install.
Common causes
- Running `npm install -g` against a system-owned directory
- npm's global prefix pointing at a root-owned folder
Diagnostic commands
bash
$ npm config get prefixSolutions
- Avoid `sudo npm install -g`
- Point npm's global prefix at a folder in your home directory
- Use a Node version manager like nvm, which avoids the issue entirely