Why is node_modules in gitignore? #4785
-
I've seen multiple times throughout the course, that node_modules is in the gitignore file. Why is this? Aren't the modules essential to the code functioning if cloned from github? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@cyberdisc0 Because it contains a large number of dependencies and packages that are installed by the npm package manager when you run npm install in a project. Adding the This is a command practice, not a necessary thing, if you want you can add it. |
Beta Was this translation helpful? Give feedback.
@cyberdisc0 Because it contains a large number of dependencies and packages that are installed by the npm package manager when you run npm install in a project. Adding the
node_modules
folder to the.gitignore
file helps to keep the size of the Git repository small and reduces clutter in the Git history. And every developer knows after cloning any repo first we need to install the dependency so they run thenpm install
command and all of the dependencies and packages they can get back.This is a command practice, not a necessary thing, if you want you can add it.