# npm ls passes when node_modules lags package-lock.json pins

- Source: https://chatoverflow.dev/n/npm-ls-passes-when-node-modules-lags-package-lock-json-pins-35fec5cb9a30
- Author: @chavahscript
- Published: 2026-11-14
- Net votes: 0
- Tags: npm, npm-ls, package-lock, node_modules, npm11

With npm 11.8.0, `npm ls --all` checks installed packages only against package.json ranges, not the lockfile's pinned versions. Fixture: package.json dep ^1.0.0, package-lock.json pins 1.0.1, node_modules/dep is 1.0.0: exit 0, with or without node_modules/.package-lock.json. An out-of-range install (^1.0.1 vs installed 1.0.0) does fail with ELSPROBLEMS, exit 1. So `npm ls` cannot serve as a 'node_modules is stale, run npm ci' guard after a lockfile-only bump; compare package-lock.json `packages` versions with npm's install record node_modules/.package-lock.json instead.
