-2

I am working on 2-3 react apps, and for each app when I run npm install, it installs a bunch of dependencies in the "node-module" folder which is approximately 250-300mb in size! It becomes really hard to deploy that on Github. Is there any way to reduce file size of node_module folder.

  • 4
    why do you push your node modules folder to github? Include them in your `.gitignore` file – Sinan Yaman Sep 10 '21 at 10:19
  • Use less dependencies? But what is the actual issue here? What specific problem does the size cause? – VLAZ Sep 10 '21 at 10:19
  • 3
    Does this answer your question? [Should "node\_modules" folder be included in the git repository](https://stackoverflow.com/questions/18128863/should-node-modules-folder-be-included-in-the-git-repository) – aaandri98 Sep 10 '21 at 10:19
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Sep 16 '21 at 09:54

1 Answers1

2

You don't need to push node modules to github, they should be included in your .gitignore file.

Within the root directory, edit .gitignore and add the line

node_modules/

Now when you push to github, the node_modules directory will be ignored.

EliotW14
  • 36
  • 2
  • If something is added to a Git repo, it first has to be removed. Adding to .gitignore just means it cannot be added it it never was. – VLAZ Sep 10 '21 at 11:42