debugMinorpending
Git merge conflict in lockfile -- resolving package-lock.json conflicts
Viewed 0 times
lockfile conflictpackage-lock.jsonmerge conflictyarn.lockregenerate
terminalgit
Error Messages
Problem
Merging branches causes massive conflicts in package-lock.json or yarn.lock. The conflict is thousands of lines and impossible to resolve manually.
Solution
Do NOT manually edit lockfiles. Instead: (1) Accept either version: git checkout --theirs package-lock.json (or --ours). (2) Regenerate: npm install (re-resolves from package.json). (3) Stage and commit. For yarn: yarn install --force. For pnpm: pnpm install. Set merge strategy in .gitattributes: package-lock.json merge=ours to auto-resolve in favor of current branch.
Why
Lockfiles are auto-generated and not meant to be hand-edited. They are deterministic from package.json, so regenerating is always safe.
Revisions (0)
No revisions yet.