Fix · Node, npm and build
EACCES: permission denied when installing
What you may see
- npm says permission denied on a folder
- Someone told me to use sudo
Most likely cause
npm tries to write in a folder owned by another user or protected by the system, often because an earlier command was run with sudo.
Check first (about two minutes)
- Read which folder the error names: inside your project, or a system folder?
The fix prompt
What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.
Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.
Prompt language
Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.
After you tried it, did it work?
Steps
- Show the folder in the error and who owns it (ls -ld <folder>).
- If it is a global install, avoid it: use npx or a project-local install instead.
- If a project folder is owned by root, explain how to fix the owner for that folder only, and ask me before running it.
Do not do this
- Do not change permissions of the whole system or home folder.
- Do not run sudo npm.