How to fix npm ERR! Error: ENOENT: no such file or directory, open 'package-lock.json' in npm
npm expected package-lock.json (especially for npm ci) but could not find it. Regenerate the lockfile, or use npm install --package-lock-only before npm ci.
Quick fix
Fixes npm ERR! Error: ENOENT: no such file or directory, open 'package-lock.json'
pwd
ls package.json package-lock.json npm-shrinkwrap.json- Confirm correct directory and lockfile presence
- Regenerate the lockfile
- Use npm ci after lockfile exists
- Handle shrinkwrap if used
pwdls package.json package-lock.json npm-shrinkwrap.jsonnpm ERR! Error: ENOENT: no such file or directory, open 'package-lock.json'
What this error means
npm ci requires an existing package-lock.json. If the lockfile was deleted, not checked in, or you are in the wrong directory, npm throws ENOENT. Merge conflicts can also remove/rename the file. In monorepos, the lockfile may live at the workspace root rather than the package folder.
Typical symptoms
- npm ci fails with ENOENT on package-lock.json
- Fresh clones without lockfile cannot run npm ci
- Lockfile missing or corrupted after merges
Common causes
- package-lock.json not committed or removed by cleanup
- Running npm ci in the wrong directory (monorepos/workspaces)
- Lockfile corrupted/absent after merge conflicts
How to fix "npm ERR! Error: ENOENT: no such file or directory, open 'package-lock.json'"
pwd
ls package.json package-lock.json npm-shrinkwrap.jsonIn monorepos, ensure you are at the root that owns the lockfile.
npm install --package-lock-onlyIf lockfile was deleted/corrupted, recreate it before npm ci.
Once package-lock.json is present and committed, run npm ci for deterministic installs.
If the project uses npm-shrinkwrap.json instead, ensure it is present or remove references if you standardized on package-lock.json.
Advanced notes
Always commit package-lock.json for reproducibility. Resolve merge conflicts carefully; if in doubt, regenerate via npm install --package-lock-only. Workspaces may share a single root lockfile—run installs from that root.
Frequently asked questions
- What does "npm ERR! Error: ENOENT: no such file or directory, open 'package-lock." mean?
- json. If the lockfile was deleted, not checked in, or you are in the wrong directory, npm throws ENOENT. Merge conflicts can also remove/rename the file.
- How do I fix "npm ERR! Error: ENOENT: no such file or directory, open 'package-lock."?
- npm expected package-lock.json (especially for npm ci) but could not find it. Regenerate the lockfile, or use npm install --package-lock-only before npm ci.
- What causes "npm ERR! Error: ENOENT: no such file or directory, open 'package-lock."?
- package-lock.json not committed or removed by cleanup Running npm ci in the wrong directory (monorepos/workspaces) Lockfile corrupted/absent after merge conflicts
- Is the "npm ERR! Error: ENOENT: no such file or directory, open 'package-lock." error serious?
- It is a low-severity error — more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- 📚npm Official Documentation
- 📖npm Docs: npm ci requirements(Official Docs)
- 💬Stack Overflow: ENOENT lockfile(Stack Overflow)
- 🐙npm/npm#18403 - ENOENT issues(GitHub)