Never hand-merge a lockfile. Resolve package.json by hand (that one is small and readable), then let npm rebuild the lock:
# during the merge conflict
git checkout --theirs package-lock.json # take the incoming lock as a base
npm install # adds whatever your package.json needs on top
git add package.json package-lock.json
git commitStarting from one side's lockfile (instead of deleting it) keeps all the other versions pinned, so you don't silently upgrade 400 packages like last time.
Root cause is usually two npm versions writing different lockfile formats. Check npm -v on both machines and agree on one, or pin it with "packageManager": "npm@10.8.2".
--theirs/--ours flip meaning during a rebase, so if you use pull --rebase, double check which side you got. ollie_dev · edited