Skip to content

NPM: View the dependency tree

npm list will generate a dependency tree for the project in the current directory and print it to the console.

npm list

Out will be similar to the following image. It will give only the top-level dependency list.

To get the full tree of npm dependencies

npm list -a
or
npm list --prod --all

--prod flag is to list only production dependencies

Out will be similar to the following image. It will give the full tree of dependencies.

You can get the dependency tree of a specific dependency

npm view [dependency] dependencies

Out will be similar to the following image.

You can also set the maximum depth level by doing

npm list --depth=[depth]

You will get a similar output with npm list --depth=1 command. It will give the full tree of dependencies.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments