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.
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.
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.
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.
npm notice access token expired or revoked. Please try logging in again.
Token has expired - npm authentication failure
npm ERR! code EAI_AGAIN
How to fix "EAI_AGAIN" in npm
npm error code E403 npm error 403 Forbidden - PUT https://registry.npmjs.org/<package>
How to fix 'E403 Forbidden' error in npm
npm ERR! code EUSAGE npm ERR! Usage error
How to fix "npm ERR! code EUSAGE" in Node.js projects
npm ERR! code E401 npm ERR! 401 Unauthorized
How to fix "E401 Unauthorized" in npm