npm cannot lstat a path (often a symlink or directory) because permissions block reading metadata. Fix ownership, remove bad symlinks, and run from user-writable filesystems.
npm uses lstat to examine files and symlinks before copying or linking them. If the path is root-owned, on a restricted filesystem, or a symlink pointing into a protected location, lstat returns EACCES and npm stops. It commonly appears when node_modules contains symlinks left from npm link/yarn, when global prefixes are root-owned, on WSL2 NTFS mounts with Windows ACLs, or in Docker/CI when the workspace is not owned by the npm user.
find node_modules -xtype l -maxdepth 4 2>/dev/null | head
stat <path>find node_modules -xtype l -delete 2>/dev/null
rm -rf node_modules package-lock.json
npm cache clean --force
npm cisudo 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"npm link creates symlinks into global installs; if the global prefix is root-owned, lstat on those links failsโeither unlink or reinstall the package locally. Long Windows paths and NTFS ACLs can also break lstat; shorter paths on the Linux filesystem avoid it. In CI, clear any vendor caches copied from root-owned images before running npm ci.
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"
On WSL, move the project to ext4 (~/projects). In Docker, run with matching UID/GID or chown the bind mount before installing.
npm install