npm was told to use npm-shrinkwrap.json but the file is missing or not in the current directory. Commit or generate it, or switch to package-lock.json before rerunning.
Fixes npm ERR! Error: ENOENT: no such file or directory, open 'npm-shrinkwrap.json'
pwd
ls npm-shrinkwrap.jsonpwdls npm-shrinkwrap.jsonnpm ERR! Error: ENOENT: no such file or directory, open 'npm-shrinkwrap.json'
On this page
npm prefers npm-shrinkwrap.json over package-lock.json when present. Some CI setups or older npm versions expect that file; if it is missing, renamed, or not checked in, fs.open fails with ENOENT and npm stops. This often happens after deleting the shrinkwrap file, migrating to package-lock without updating scripts, or in monorepos where the current directory differs from where the shrinkwrap lives.
pwd
ls npm-shrinkwrap.jsonIf missing, ensure you are in the package root that owns the shrinkwrap.
git checkout -- npm-shrinkwrap.json || true
npm shrinkwrapCommit the file if your pipeline expects it.
If your project uses package-lock.json, update CI scripts to stop requiring shrinkwrap and ensure package-lock is committed.
rm -rf node_modules package-lock.json npm-shrinkwrap.json
npm install --package-lock-only
npm ciRun npm from the package directory that owns the shrinkwrap. Each package can have its own lock; ensure the correct one exists.
npm resolves to npm-shrinkwrap.json before package-lock.json; keeping both can confuse CI—pick one. If you migrate off shrinkwrap, update npm to v7+ and remove scripts that expect it. In workspaces, each package may manage its own lock; ensure the shrinkwrap is committed for each published package to preserve exact versions.