npm looked for node_modules but it does not exist yet (fresh checkout, cleaned workspace, or wrong working directory). Install dependencies or point npm at the correct folder.
npm expects node_modules to exist after installs and when resolving binaries. If you run scripts before installing dependencies, mount an empty volume over the project, or execute in the wrong directory, stat on node_modules fails with ENOENT. CI pipelines that clean workspaces, Docker bind mounts that shadow the folder, and monorepos with nested packages commonly see this when running npm run before npm install.
pwd
ls node_modules 2>/dev/nullnpm ci
# or
npm installEnsure your container workdir matches the project root and that you are not mounting an empty host folder over node_modules.
If using workspaces, run npm inside the specific package that owns node_modules or enable workspaces at the root.
CI best practice is npm ci after checkout and before running scripts; cache node_modules cautiously to avoid stale/empty mounts. Docker Compose often mounts the repo; build a layer that installs dependencies, or mount only source and keep node_modules inside the container image. With pnpm/yarn workspaces, node_modules may be hoisted—ensure your script runs where they are present.
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 run <script>