ERR cicd dependency_install ai_generated true

npm ERR! `npm ci` can only install packages when your package-lock.json or npm-shrinkwrap.json is in sync with package.json

ID: cicd/npm-ci-failed

Also available as: JSON · Markdown
92%Fix Rate
91%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

npm ci fails because package-lock.json is out of sync with package.json. Unlike npm install, npm ci requires exact lockfile consistency and will not modify the lockfile.

generic

Workarounds

  1. 94% success Run npm install locally and commit the updated package-lock.json
    Run 'npm install' locally to update package-lock.json, verify it works, then commit both package.json and package-lock.json together
  2. 87% success Ensure CI Node.js and npm versions match local development versions
    Use the same Node.js version in CI as locally (via .nvmrc or .node-version). Different npm versions can produce incompatible lockfile formats (v1, v2, v3)

Dead Ends

Common approaches that don't work:

  1. Replace npm ci with npm install in CI pipelines 55% fail

    npm install may resolve different dependency versions than what was tested locally, introducing non-deterministic builds and subtle bugs

  2. Delete package-lock.json and regenerate it in CI 70% fail

    Regenerating the lockfile in CI defeats the purpose of deterministic builds; different npm versions may produce different lockfiles

Error Chain

Leads to:
Preceded by:
Frequently confused with: