How to fix npm ERR! Error: EACCES: permission denied, chmod '<path>' in npm
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}')- Inspect the path and mount options
- Fix ownership for files you own
- Use user-owned cache and prefix
- Move off NTFS/read-only mounts
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
- 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
- Antivirus/EDR or IDE locking files during chmod
- Docker/CI running npm as non-owner of the workspace volume
- Corporate macOS images restricting writes to /usr/local or /opt/homebrew
How to fix "npm ERR! Error: EACCES: permission denied, chmod '<path>'"
stat <path>
mount | grep $(df -P <path> | tail -1 | awk '{print $1}')sudo chown -R $(whoami) .
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}npm config set cache ~/.npm-cache
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
export PATH="$HOME/.npm-global/bin:$PATH"On WSL, clone to ~/projects (ext4) instead of /mnt/c. Avoid installing from network shares; use a local clone to allow chmod.
rm -rf node_modules package-lock.json
npm cache clean --force
npm ciRun 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
- 📚npm Official Documentation
- 📖npm Docs: Resolving EACCES globally(Official Docs)
- 📖Microsoft Docs: WSL file permission considerations(Official Docs)
- 💬Stack Overflow: EACCES chmod during npm install(Stack Overflow)
- 🐙