How to fix npm ERR! Error: ENOENT: no such file or directory, open 'package-lock.json' in npm

npmBEGINNERLOWUpdated Dec 2, 2025· 150 views

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
  1. Confirm correct directory and lockfile presence
  2. Regenerate the lockfile
  3. Use npm ci after lockfile exists
  4. Handle shrinkwrap if used
npm — error
pwd
ls package.json package-lock.json npm-shrinkwrap.json
npm 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

  1. package-lock.json not committed or removed by cleanup
  2. Running npm ci in the wrong directory (monorepos/workspaces)
  3. Lockfile corrupted/absent after merge conflicts

How to fix "npm ERR! Error: ENOENT: no such file or directory, open 'package-lock.json'"

1Confirm correct directory and lockfile presence
bash
pwd
ls package.json package-lock.json npm-shrinkwrap.json

In monorepos, ensure you are at the root that owns the lockfile.

2Regenerate the lockfile
bash
npm install --package-lock-only

If lockfile was deleted/corrupted, recreate it before npm ci.

3Use npm ci after lockfile exists

Once package-lock.json is present and committed, run npm ci for deterministic installs.

4Handle shrinkwrap if used

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