npm tried to rename a staging folder that had already been removed (cleanup, AV, or race). Clean node_modules/cache, stop concurrent installs, and reinstall once.
npm writes temp content under node_modules/.staging and then renames it into place. If another process deletes .staging (cleanup script, AV, concurrent npm), the rename target disappears and npm throws ENOENT. It also occurs when node_modules is mounted from an empty host volume, or when previous failed installs left partial folders that get removed mid-run. Running multiple npm installs in parallel is a common trigger.
Ensure only one npm/yarn/pnpm process runs in the project. Stop scripts that auto-clean node_modules.
rm -rf node_modules package-lock.json
npm cache clean --forceAdd a Defender/AV exclusion for the project during installation so .staging is not removed mid-run.
In Docker/CI, do not mount an empty host node_modules over the container path. Build dependencies inside the image or mount only source.
npm is not safe to run in parallel on the same tree; run installs sequentially. In CI, avoid cleaning node_modules mid-install (e.g., concurrent cache warmers). If you need per-step isolation, install in a fresh workspace each time. Docker Compose users should mount only source and keep node_modules inside the image or a dedicated volume to prevent disappearing .staging directories.
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"
npm ci