Home > Back-end >  angular project broken after git merge
angular project broken after git merge

Time:05-25

I've had this weird problem: I checked out a feature branch from my master branch. Did the work...committed my work. Checkout out master and merged the feature branch into it. All the new files where inside the master branch now. All good. But when i looked at the project in localhost:4200 (ng serve) I got all kinds of problems. Modules not present, navbars and router outlets missing. (But all the files and changes where there in the vscode file browser!) Everything seemed broken. After some reading i tried switching back to the feature branch and switching back to the master branch...then i removed the node_modules cache: rm -Rf node_modules/.cache As per this article: Merge conflict marker encountered. It was the only article i could find slightly resembling my problem. Unfortunately that didn't work either. So i tried npm update && npm install ..because why not? I was getting pretty desperate at this point :) That fixed it! My question is why? I'm pretty new to node and angular and i want to understand what is going on.

CodePudding user response:

That due to missing node_modules. Here is a explanation.

As you make changes on feature branch it may happen that you add some new npm modules. So when you merge with master branch. node_modules folder is in .gitignore file so it won't update which is a good practise. So you need to do npm install after every merge.

  • Related