Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it normal for Gulp to include so many node_modules when installing Gulp?

I just installed Gulp with the following commands:

npm install --global gulp

and

npm install --save-dev gulp

Everything works fine except my node_modules folder is now filled with modules I have never heard of. All the tutorials online about Gulp only show the Gulp module in this folder. For me it's the following:

node_modules folder

Question:

Is it normal for the node_modules folder to be having these modules?

Thank you in advance

What tried:

Updating gulp / node / npm

Versions:

gulp -v :

[13:45:13] CLI version 3.9.0

[13:45:13] Local version 3.9.0

npm -v : 3.3.9

node -v : v5.0.0

like image 377
Semm D Avatar asked Nov 18 '15 12:11

Semm D


People also ask

Do I need to install node modules every time?

No, npm is a package manager. You only need to install it once in a system.

Where does gulp get installed?

The global npm directory is where your packages get installed when you install them globally. You can check where it is by typing in npm root -g in the command line. For Mac users, if the root command returns a directory like /Users/YOURNAME/node_modules then this will cause the command not found error.

How does installing gulp globally?

To install the Gulp CLI globally, on your command line, run npm install gulp-cli -g . The -g flag means npm will install the package in the global npm directory, so you can run the gulp command from any directory.

Do I need to install gulp globally?

etc. and running with npm run test then you shouldn't need the global install at all. Both methods are useful for getting people set up with your project since sudo isn't needed. It also means that gulp will be updated when the version is bumped in the package.


1 Answers

this is due to the maximally flat dependency tree of npm 3. Instead of all the node_modules that gulp requires being installed in a node_modules folder within the gulp dependency, they are all installed in the root node_modules folder.

https://docs.npmjs.com/how-npm-works/npm3#npm-v3-dependency-resolution

like image 59
Conor Hastings Avatar answered Nov 26 '22 11:11

Conor Hastings