Hashmat
Hashmat

Reputation: 767

Merge conflict marker encountered

SourceTree Merge Conflict

I have created a local "Test" branch in SourceTree for testing some new features and everything seemed to work fine. Then I merged the "master" branch into my local "Test" branch and unfortunately, pushed it. But since then by running "ng serve" I'm getting the following error:


52 <<<<<<< HEAD
app/app.module.ts:54:1 - error TS1185: Merge conflict marker encountered.

54 =======
app/app.module.ts:56:1 - error TS1185: Merge conflict marker encountered.

56 >>>>>>> master
app/example/example.module.ts:9:1 - error TS1185: Merge conflict marker encountered.

9 <<<<<<< HEAD

I have no idea what's going on here. Is there any way to solve this issue easily?

Upvotes: 59

Views: 68769

Answers (11)

Prashant Singh
Prashant Singh

Reputation: 1

This issue can be resolved via these steps:-

  1. Stop the dev server
  2. Stop the formatting job
  3. Switch the branch
  4. Run the formatting job
  5. Switch back to the starting branch
  6. Run the dev server

The issue would be resolved!!

Upvotes: 0

Sofien
Sofien

Reputation: 1710

For those coming from Google that:

I fixed it by deleting node_modules cache: rm -rf node_modules/.cache

Here is the link to an article that explains what's happening

Upvotes: 58

mouchin777
mouchin777

Reputation: 1588

None of the answers worked for me, but rebuilding my docker containers

docker-compose down -v && yarn install && docker-compose build && docker-compose up -d

fixed it

Upvotes: 0

Stephen Horvath
Stephen Horvath

Reputation: 5588

If tsconfig.json still has conflicts, the above error will appear in every source file.

Upvotes: 0

sebtheiler
sebtheiler

Reputation: 2557

For anyone coming from Google, I had a similar issue in React, but I was 100% confident that I had already resolved all conflicts.

I fixed it by switching to another branch, then switching back to the original.


If this still does not fix the issue, remove the Node Modules cache with rm -Rf node_modules/.cache

Upvotes: 129

Ramana
Ramana

Reputation: 1965

while you're merging master into your local feature branch there are some conflicts, you need to resolve them by accepting the current or incoming changes. Open those files and remove these <<<<<<< HEAD >>>>>>> master and commit your changes. If you've Visual Studio Code will clearly show you the conflicts.

Files that had conflict marker:

app/example/example.module.ts:9:1 // in this file line number 9 should've conflict marker **>>>>>**
app/app.module.ts:54:1 // in this file line number 54 should've conflict marker **>>>>>**
app/app.module.ts:56:1 // in this file line number 56 should've conflict marker **>>>>>**

Once you resolved the conflicts and still getting the error, the files might have been cached, try to switching to another branch, then switching back to the original.

Still Webpack isn't noticing your file changes - https://dev.to/pnevares/webpack-isn-t-noticing-your-file-changes-did-you-do-something-wrong-34dc

Upvotes: 20

Graham Laight
Graham Laight

Reputation: 4850

If the conflict markers are in an auto-generated file, regenerate it.

Upvotes: 0

neberaa
neberaa

Reputation: 2452

Had the same issue, but with a Vue.js project. Suggested solutions did not work for me. I had to remove and re-install all the dependencies. Only after rm -rf node_modules && yarn install the error goes away!

Upvotes: 2

Barry
Barry

Reputation: 71

Encountered this issue in React, and I am sure that the merge conflicts are resolved.

I fixed it by editing the file content, by simply add/remove some code, wait it compile and reload again.

Upvotes: 7

Robert Hovhannisyan
Robert Hovhannisyan

Reputation: 3361

Also, you can try to stop and run the npm as a short solution. Worked for me.

Upvotes: 2

ChuChu
ChuChu

Reputation: 359

Make sure you pulled lastest code from the master branch before merging Master into Test.

Upvotes: 0

Related Questions