NPM is installing lots of libraries

前端 未结 2 916
情书的邮戳
情书的邮戳 2021-01-28 11:33

When I use npm install base from package.json file it installs 337 libraries :/ Here is my package file

{
  \"name\": \"system_glowna\         


        
相关标签:
2条回答
  • 2021-01-28 12:00

    You've told it to install a fairly large number of libraries. Each of those libraries has its own dependencies, which are necessary for that library to run. You can't limit or prevent that unless you just don't want to use the library in question.

    Note that installing lots of libraries isn't, by itself, a problem.

    0 讨论(0)
  • 2021-01-28 12:14

    npm prior to version 3.x installs libraries in a tree structure, so each library has its own node_modules and so on. It could lead (or almost always leads) to duplicated libraries inside different node_modules packages and results in a pretty big node_modules folder. Things get tricky e.g. on Windows, when paths could be too long to delete node_modules easily after.

    However, after 3.x release of npm, it uses flat folder structure by default and only if there is any conflict, it installs proper versions for each library.

    Note to yourself - the fact that npm installs so many libraries is necessary in order for each library to work properly :)

    0 讨论(0)
提交回复
热议问题