4

I have the following project directory structure enter image description here

React_Native\reporTown file is used for the front-end. When I clone the code, I have to run "npm install" command in the reporTown folder to run the front-end. After executing npm install, I am executing npm start to run the project. However, when I execute the npm install command, there are a lot of (4k+) changes occur as can be seen from the image below:

In the upper directory's .gitignore file, I have

node_modules
**/node_modules
node_modules/

lines. In the reporTown .gitignore file which is in the reporTown folder, I have

/node_modules
node_modules/
node_modules
**/node_modules

lines.

It seems that I am not able to add the node_modules to the .gitignore file properly. What should I do so that I won't see the changes after I run the npm install command? enter image description here

  • 2
    Does the repository already have the node_modules folder? If so, git will not ignore it. You need to manually tell git to remove it from source control by following the steps provided in this post: https://stackoverflow.com/questions/50675829/remove-node-modules-from-git-in-vscode – Bruno Farias Dec 25 '21 at 13:29
  • Yes the project I am cloning from the github already has the node_modules folder. Should my team member delete the node_modules folder from the project and push to github? – Bilkent Ogrencisi Dec 25 '21 at 13:30
  • 1
    Yes, he needs to follow the steps provided in the link, then push to Github the commit generated by it. – Bruno Farias Dec 25 '21 at 13:45
  • 1
    This has solved my issue, thank you – Bilkent Ogrencisi Dec 25 '21 at 16:33

0 Answers0