How to fix npm ERR! Error: EACCES: permission denied, chmod '<path>' in npm

npmBEGINNERMEDIUMUpdated Dec 2, 2025· 140 views

npm failed to set executable bits on an installed file because the path is not writable or the filesystem blocks chmod. Use user-owned prefixes, fix ownership, or move off read-only/NTFS mounts.

Quick fix

Fixes npm ERR! Error: EACCES: permission denied, chmod '<path>'

stat <path>
mount | grep $(df -P <path> | tail -1 | awk '{print $1}')
  1. Inspect the path and mount options
  2. Fix ownership for files you own
  3. Use user-owned cache and prefix
  4. Move off NTFS/read-only mounts
npm — error
stat <path>
mount | grep $(df -P <path> | tail -1 | awk '{print $1}')
npm ERR! Error: EACCES: permission denied, chmod '<path>'

What this error means

npm calls chmod to mark binaries executable in node_modules/.bin or in the global bin directory. If the target is owned by root, mounted read-only, or on a filesystem that ignores POSIX modes (NTFS/SMB), chmod returns EACCES and npm aborts the install. This often happens after sudo installs leave root-owned files, when installing globally to /usr/local as a non-root user, in WSL2 working on /mnt/c (NTFS), or in Docker/CI when npm runs as a non-owner of the mounted volume.

Typical symptoms

  • npm install/ci fails on EACCES: permission denied, chmod '<path>'
  • Global installs work with sudo/Admin but fail as normal user
  • Binaries in node_modules/.bin remain non-executable
  • On WSL/Windows, chmod warnings appear for NTFS paths
  • CI/Docker jobs fail while local installs succeed

Common causes

  1. Root-owned global prefix or node_modules from prior sudo installs
  2. Filesystem mounted read-only or with noexec flag
  3. NTFS/SMB mounts (WSL2, network drives) that ignore chmod
  4. Antivirus/EDR or IDE locking files during chmod
  5. Docker/CI running npm as non-owner of the workspace volume
  6. Corporate macOS images restricting writes to /usr/local or /opt/homebrew

How to fix "npm ERR! Error: EACCES: permission denied, chmod '<path>'"

1Inspect the path and mount options
bash
stat <path>
mount | grep $(df -P <path> | tail -1 | awk '{print $1}')
2Fix ownership for files you own
bash
sudo chown -R $(whoami) .
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
3Use user-owned cache and prefix
bash
npm config set cache ~/.npm-cache
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
export PATH="$HOME/.npm-global/bin:$PATH"
4Move off NTFS/read-only mounts

On WSL, clone to ~/projects (ext4) instead of /mnt/c. Avoid installing from network shares; use a local clone to allow chmod.

5Reinstall cleanly
bash
rm -rf node_modules package-lock.json
npm cache clean --force
npm ci
6For CI/Docker, match user IDs

Run containers with --user matching host UID/GID or chown the workspace volume so chmod can apply executable bits.

Advanced notes

noexec mounts (some corporate images, secure /tmp) will block chmod even for the owner; install on a writable, exec-capable path instead. Homebrew installs under /opt/homebrew can drift to root-owned after OS updates—using nvm/fnm keeps npm files in $HOME. In Windows/WSL, NTFS ignores Unix execute bits; keep projects on the Linux filesystem to ensure binaries are executable.

Frequently asked questions

What does "npm ERR! Error: EACCES: permission denied, chmod '<path>'" mean?
bin or in the global bin directory. If the target is owned by root, mounted read-only, or on a filesystem that ignores POSIX modes (NTFS/SMB), chmod returns EACCES and npm aborts the install. This often happens after sudo installs leave root-owned files, when installing globally to /usr/local as a non-root user, in WSL2 working on /mnt/c (NTFS), or in Docker/CI when npm runs as a non-owner of the mounted volume.
How do I fix "npm ERR! Error: EACCES: permission denied, chmod '<path>'"?
npm failed to set executable bits on an installed file because the path is not writable or the filesystem blocks chmod. Use user-owned prefixes, fix ownership, or move off read-only/NTFS mounts.
What causes "npm ERR! Error: EACCES: permission denied, chmod '<path>'"?
Root-owned global prefix or node_modules from prior sudo installs Filesystem mounted read-only or with noexec flag NTFS/SMB mounts (WSL2, network drives) that ignore chmod
Is the "npm ERR! Error: EACCES: permission denied, chmod '<path>'" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading