简体   繁体   中英

How to install node_modules only those packages defined in the file package.json

When I used npm install of Laravel project. It creates a lot of unnecessary libraries. I want to know how to install only the packages I have defined in package.json file.

node_modules内容的屏幕截图

It is because npm install is recursive. Let's say your project require the module A , which itself require the module B , npm install will end up installing both.

In short, even if you only used one module in your package.json , all the modules you see are needed.

Those packages have dependencies which have dependencies of their own. So unless you want to break your application, I wouldn't alter it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM