sdfsdf
sdfsdf

Reputation: 5590

Why would you include node_modules in a .gitignore file if you're just going to download it from npm?

Seems like ignoring the node_modules folder just adds an extra step for everyone downloading a project because they have to run npm install or yarn

Upvotes: 1

Views: 44

Answers (2)

Willem van der Veen
Willem van der Veen

Reputation: 36630

Some parts of NodeJS are dependend on the OS because it might actually require system calls from the operating system. System call are ofcourse platform dependend and thus if these dependendencies rely on this they will not work properly. If you run npm i your packages get installed for the right OS.

Upvotes: 1

Geuis
Geuis

Reputation: 42277

Usually node_modules can become quite large. That's one reason.

The more important reason is that many dependencies have a compilation build as part of their installation step. That means that if you install your app on MacOS but your production environment runs on Linux, then the compiled aspects of some dependencies won't work.

Upvotes: 1

Related Questions