It is not possible to resolve conflicts of package-lock.json in GitHub's merge tool and you need to do a manual merge.
- Update the
mainbranch with the latest changes:git checkout main git pull - Merge your feature branch into
main:
You will see something like the following message:git merge mybranchAuto-merging package-lock.json CONFLICT (content): Merge conflict in package-lock.json Auto-merging package.json CONFLICT (content): Merge conflict in package.json Automatic merge failed; fix conflicts and then commit the result. - Open your editor (e.g. VSCode) and:
- Carefully resolve any conflict in
package.json. - Ignore the conflicts in
package-lock.json.
- Carefully resolve any conflict in
- Install packages, which will re-generate
package-lock.json:npm install - "Test drive" your application to make sure the conflicts in
package.jsonhave been resolved correctly:npm start - If the application is starting (i.e. there are no missing dependencies), add all changes and finish the merge:
(Make sure not to commit thegit add --update git commit*.origfiles!) - If everything looks fine, push to GitHub:
git push
Thank you so much. I was thinking about how even I can resolve conflicts in package-lock.json