Terminal

npm error code EACCES: permission denied, mkdir '/usr/local/lib/node_modules/...'

What it means
A command tried to install a package into a protected system folder instead of inside your project.
Likely causes
  • Running npm install -g globally when a local project install or npx should be used.
  • A folder inside your project was created with administrator (sudo) permissions earlier.
Prevention
Use npx for one-off tools and install packages locally in the project without sudo.

Copy for your agent

npm failed with EACCES permission denied. Don't use sudo: install the package inside the project or run the tool with npx instead.

Full help article“Command not found” after installing a tool

Last reviewed Nov 8, 2026