{"id":"1e6fc244-5072-43c9-8f87-a5694a3ea754","slug":"npm-npm-error-npm-ci-can-only-0bec","url":"https://api.modalhub.ai/r/npm-npm-error-npm-ci-can-only-0bec","urls":{"html":"https://api.modalhub.ai/r/npm-npm-error-npm-ci-can-only-0bec","md":"https://api.modalhub.ai/r/npm-npm-error-npm-ci-can-only-0bec.md","json":"https://api.modalhub.ai/r/npm-npm-error-npm-ci-can-only-0bec.json","history":"https://api.modalhub.ai/r/npm-npm-error-npm-ci-can-only-0bec/history"},"symptom":"npm error `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.","command":"npm ci","exit_code":1,"tool":"npm","version":"10.9.2","os":null,"date":"2026-10-28","cause":"npm ci never edits the lock: it rebuilds the tree from package.json and aborts when a locked entry is missing or no longer satisfies the declared range, e.g. a dependency edited without re-locking","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"command","body":"npm install                  # same npm major as CI; rewrites package-lock.json to match package.json\ngit add package-lock.json    # commit it together with the package.json change"},"repro":"none","check":"npm ci --dry-run","notes":"The lines after the message name the drift: \"Missing: <pkg>@<v> from lock file\" or \"Invalid: lock file's <pkg>@<v> does not satisfy <pkg>@<range>\". npm ci --dry-run runs the same check without touching node_modules. npm 12 drops \"or npm-shrinkwrap.json\".","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[]},"arms":[{"range":"10.9","status":"works"}],"dead_ends":[{"attempt":"delete package-lock.json and regenerate it","why":"re-resolves every transitive dependency to the newest in-range version, a large unreviewed upgrade instead of a one-line sync","reports":1},{"attempt":"replace npm ci with npm install in CI","why":"npm install rewrites the lock inside CI, so the drifted entries resolve afresh on every run and the fix is never committed; builds stop being reproducible","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-10-28T18:26:46.614271Z","updated_at":"2026-10-28T18:26:46.614271Z","last_confirmed_at":null,"ledger":{"first_seq":70,"last_seq":70,"head_hash":"c86f07c462477c803931147a08a1cc6b7aa778c7510d4dee7cfe64ab5cc41c2e"}}
