npm cannot stat a file/directory (node_modules, cache, or global path) because permissions or ACLs block metadata access. Fix ownership, remove broken links, and use user-owned locations.
npm stats files to read metadata while resolving versions, validating cache entries, and linking binaries. If the path is root-owned, on a restricted mount, or a broken symlink pointing into a locked area, stat returns EACCES and npm stops. The error appears after sudo installs leave protected folders, when working on NTFS/SMB mounts with Windows ACLs, or when corporate policies restrict /usr/local. Docker/CI can hit it when the workspace volume is owned by root but npm runs as a different user.
stat <path>
find node_modules -xtype l -maxdepth 4 2>/dev/nullsudo chown -R $(whoami) .
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}find node_modules -xtype l -delete 2>/dev/null
rm -rf node_modules package-lock.json
npm cache clean --force
npm cinpm config set cache ~/.npm-cache
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
export PATH="$HOME/.npm-global/bin:$PATH"Stat failures often surface when a symlink inside node_modules points to a system-wide path (e.g., globally linked package) that is not readable by the current user; removing the symlink and reinstalling locally resolves it. In CI, earlier steps may produce root-owned artifacts—chown the workspace before npm ci. macOS Homebrew under /opt/homebrew can become root-owned after OS updates; using nvm/fnm to keep installs in $HOME avoids that drift.
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
Move the project off network/NTFS shares; on WSL, work inside the Linux filesystem. In Docker, match UID/GID or chown the bind mount.