📦No permission, so install failed (EACCES)
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
Installing stopped because you don't have permission to write files in that folder. It mostly happens with global (-g) installs.
🤔 Why does it happen?
- You tried to install into a computer-wide folder (npm install -g)
- Something was installed with sudo before, so the folder's owner changed
🔧 Try this
- Avoid adding sudo, since it can make the problem bigger
- Reinstalling Node with a Node version manager like nvm fixes it most of the time
🤖 Ask your AI like this
I get the EACCES permission error below when installing with npm. My computer is [Mac/Windows]. Please tell me step by step how to fix it safely without sudo. [Paste the full error here]
Replace the [ ] parts with your own situation, and paste the error with a few extra lines before and after it.
Related terms
Other errors in this group
- Module not found
Module not found: Can't resolve - Command not found
command not found - Package version conflict (ERESOLVE)
npm ERR! ERESOLVE unable to resolve dependency tree - Port already in use
EADDRINUSE: address already in use - Types don't match (TypeScript)
Type 'X' is not assignable to type 'Y' - Node version doesn't match
The engine "node" is incompatible with this module - Out of memory (heap out of memory)
JavaScript heap out of memory - Can't use import statements (module settings)
SyntaxError: Cannot use import statement outside a module - Build failed on code checks (ESLint)
Failed to compile — ESLint errors - File or folder not found (ENOENT)
ENOENT: no such file or directory