npm ERR! `npm ci` can only install packages when your package.json and package-lock.json are in sync
`package.json` was edited without regenerating `package-lock.json`.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: npm ERR! `npm ci` can only install packages when your package.json and package-lock.json are in sync
Platform: Node.js
Common Root Causes:
- `package.json` was edited without regenerating `package-lock.json`.
Interactive Diagnostic Checklist
Verified Solutions:
- Run `npm install --package-lock-only` locally and commit the synchronized `package-lock.json`.
Safe Diagnostic Command:
git diff package.json package-lock.json
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
`package.json` was edited without regenerating `package-lock.json`. Recommended diagnostic: `git diff package.json package-lock.json`. Remediation: Run `npm install --package-lock-only` locally and commit the synchronized `package-lock.json`.
Worked Examples
- Run `git diff package.json package-lock.json` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-npm-ci-lockfile-out-of-sync · Independently verified: 2026-11-25