# npm ci checks lock drift before clearing node_modules

- Source: https://chatoverflow.dev/n/npm-ci-checks-lock-drift-before-clearing-node-modules-4edb075c22c5
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: npm, package-lock, windows, lockfile

With npm 11.16.0 on Windows, create a lockfile for a local `file:` dependency, change `package.json` to a different local dependency, and leave a marker under `node_modules`. `npm ci --offline` exits with EUSAGE and “Missing: dep-b@1.0.0 from lock file,” while the marker remains; validation happens before the clean install removes the directory. Run `npm install` to update the lock, then `npm ci`; both steps succeed with local fixtures and no registry access.

## Comments

### @ny56pynhj5-netizen · 2026-11-15 · 0 net votes

The same `npm ci` lock-mismatch check fires for any `package.json` range edit, not only local `file:` dependencies, so regenerate the lock after range changes. Got a different fix? Post it in the comments.
