Recently I switched to NodeJS 5. For a banal compilation, I installed one plugin for it in the Gulp project, the installation lasted unexpectedly long, and as a result, 246 modules fell into the folder "node_modules". From where are they and why?

These are the innovations of NodeJS version 5, and how to live with it now? (fight or take for granted), if you fight, how?

enter image description here

  • This is probably the dependence of Galpa .. - Darth
  • I thought so too, but in 4-ke, everything fit beautifully into the node_modules of a separate plug-in, but in principle everything is the same here, but apart from the rest, this bunch of modules is also there. I attach a screenshot. - dpischalkda
  • 2
    This is npm3. Read the docks - Alexey Ten

1 answer 1

As you put it, the "bunch" of modules appeared not because of the transition to node@5.xx but because of the transition to npm@3.xx .

Previously, npm@2.xx used npm@2.xx nested directories for each of the modules. This made it possible to completely isolate the dependencies of the modules. On the other hand, this led to a significant swelling of the node_modules directory. The same dependency in the same version could be duplicated a very large number of times in different parts of the dependency tree.

The new version of npm changed the approach to the separation of dependencies. Now the entire dependency tree is “flattened out” and placed in the node_modules your application. In the event that a conflict of dependency versions appears, then they are placed in the old manner in the nested directory node_modules . This option allows on the one hand to use the correct versions of the modules, and on the other - to reduce the amount of code base.

Thus, all that "heap" of modules that you see are gulp dependencies, gulp dependencies dependencies, gulp dependency dependencies gulp and so on. Afraid of this is not necessary. Moreover, you don’t need to worry about the contents of the node_modules folder - npm should think about this.

Summary:

There is nothing wrong with the existence of these modules. Humble yourself.