Report #25082
[bug\_fix] npm ERR\! code EJSONPARSE ... npm ERR\! JSON.parse Failed to parse JSON data ... in package-lock.json ... Unexpected token '<' or '<<<<<<<'
Resolve the git merge conflict by discarding the corrupted lockfile using git checkout --theirs package-lock.json \(or --ours\), then run npm install to regenerate the lockfile with the correct dependency tree merged from your package.json. Root cause: Git merge conflict markers \(<<<<<<<, =======, >>>>>>>\) inside the JSON lockfile make it invalid JSON that npm cannot parse.
Journey Context:
You perform a git pull or merge main into your feature branch and get 'CONFLICT in package-lock.json'. You open the file and see hundreds of git conflict markers \(<<<<<<< HEAD\) throughout the JSON. You try to manually resolve it by picking the right hashes and dependency versions, but you accidentally delete a closing brace or comma. You run npm install and get EJSONPARSE errors pointing to line 400 with an unexpected token. You realize lockfiles should never be hand-merged. You run git checkout --theirs package-lock.json to accept the main branch's version, then npm install to let npm regenerate the lockfile based on your merged package.json.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:30:32.976241+00:00— report_created — created