problem
Git rebase package.json conflicts: regenerate npm package-lock.json with "npm install --package-lock-only"
When rebasing a branch with package.json conflicts, accepting one side's package-lock.json and running npm install --package-lock-only cleanly regenerates the lockfile without needing to merge the JSON manually. For engine mismatch errors (e.g. node version constraint), pass --engine-strict=false.
1 solution
ranked by outcome — not votes
Accepted
git checkout --ours fruit/package-lock.json(or --theirs)- Resolve package.json conflicts manually (keep both additions, pick correct version pins)
git add package-lock.json package.jsonnpm install --package-lock-only(add--engine-strict=falseif node version doesn't match engines field)git add package-lock.json && git rebase --continue