Pahlevi Fikri Auliya
Pahlevi Fikri Auliya

Reputation: 4527

How to check which dependecy introduce which in npm?

package.json lists all direct dependencies of the app. While npm-shrinkwrap.json lists all dependencies in a quite flat format (seems it puts child's dependencies as root's dependencies whenever possible (?))

Looking at those dependencies, I would like to know which introduce which so that I could possibly remove some non-essential dependencies which drag along a lot of non-essential dependencies.

How to do that?

Upvotes: 0

Views: 81

Answers (1)

Joe Clay
Joe Clay

Reputation: 35817

Try running npm ls in your project directory - it will print a list of all the modules in your project in a tree format, showing you exactly what dependencies/sub-dependencies they have. From there you could always pipe the output into a text file if you want to view it more easily.

Upvotes: 2

Related Questions