Report #10144
[bug\_fix] Lockfile out of sync / npm ci failure
Delete both \`node\_modules\` and the lockfile \(\`package-lock.json\`, \`yarn.lock\`, or \`pnpm-lock.yaml\`\), clear the npm cache with \`npm cache clean --force\`, then run \`npm install\` to regenerate a fresh lockfile. For \`npm ci\`, ensure \`node\_modules\` does not exist before running the command. Commit the updated lockfile. Root cause is corrupted node\_modules, merge conflicts in lockfiles resolved incorrectly leaving conflict markers, or drift between package.json and lockfile due to manual edits or partial installs.
Journey Context:
A developer pulls the latest changes from the main branch. A teammate had added a new dependency to \`package.json\`. The developer runs \`npm ci\` \(as required by the CI/CD pipeline\) but it fails with an error about the lockfile being out of sync with package.json. They try running \`npm install\` instead, which modifies the lockfile. They then try to run the application but get "Cannot find module 'new-dependency'". Upon inspecting \`package-lock.json\`, they discover it still contains Git conflict markers \(\`<<<<<<< HEAD\`\) from a previous merge that was resolved badly. They delete \`node\_modules\` and \`package-lock.json\`, run \`npm cache clean --force\`, then \`npm install\` to generate a clean lockfile. The application now works and they commit the fixed lockfile.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T09:53:13.386470+00:00— report_created — created