# npm ERR! code EUSAGE 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-lockfile-outdated`
- **Domain:** cicd
- **Category:** install_error
- **Error Code:** `EUSAGE`
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

npm ci failed because package-lock.json is out of sync with package.json, often due to manual edits to package.json without running npm install to update the lockfile.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| npm 9.6.0 | active | — | — |
| Node.js 18.16.0 | active | — | — |
| npm 10.2.0 | active | — | — |

## Workarounds

1. **Regenerate the lockfile by running: npm install && git add package-lock.json && git commit -m 'Update lockfile'. Then retry npm ci.** (95% success)
   ```
   Regenerate the lockfile by running: npm install && git add package-lock.json && git commit -m 'Update lockfile'. Then retry npm ci.
   ```
2. **If the discrepancy is due to version ranges, pin exact versions in package.json to avoid lockfile drift.** (85% success)
   ```
   If the discrepancy is due to version ranges, pin exact versions in package.json to avoid lockfile drift.
   ```

## Dead Ends

- **** — Deleting node_modules and package-lock.json and re-running npm install may break CI reproducibility by generating a different lockfile. (20% fail)
- **** — Running npm audit fix can modify package.json or lockfile, introducing unintended changes. (30% fail)
