by Sai gowtham

How to list installed packages in Npm

In this tutorial, we are going to learn about how to list (view) the npm installed packages and its dependencies in a tree structure in the terminal.

Listing installed packages and dependencies

The npm ls command helps us to list (view) all versions of installed packages and their dependencies in the terminal.

npm ls

Output:

node-app@1.0.0 /Users/saigowtham/Desktop/node-app
├─┬ cors@2.8.5
│ ├── object-assign@4.1.1
│ └── vary@1.1.2
├── date-fns@2.15.0
├── dotenv@8.2.0
├── esm@3.2.25
├─┬ express@4.17.1
│ ├─┬ accepts@1.3.7
│ │ ├─┬ mime-types@2.1.27
│ │ │ └── mime-db@1.44.0
│ │ └── negotiator@0.6.2
│ ├── array-flatten@1.1.1

Listing installed packages but not dependencies

If you want to list only the installed packages without their dependencies, you need to pass the — depth=0 flag at the end of the npm ls command.

npm ls — depth=0

Output:

node-app@1.0.0 /Users/saigowtham/Desktop/node-app
├── cors@2.8.5
├── date-fns@2.15.0
├── dotenv@8.2.0
├── esm@3.2.25
├── express@4.17.1
├── express-rate-limit@5.1.3
└── rimraf@3.0.2

You can also list only the production dependency packages in a tree view like this.

npm ls --prod

or development dependencies:

npm ls --dev

You can also list the globally installed packages instead of in the current project by adding a -g flag to the npm ls command.

npm ls -g

# without dependencies

npm ls -g --depth=0

Css Tutorials & Demos

How rotate an image continuously in CSS

In this demo, we are going to learn about how to rotate an image continuously using the css animations.

How to create a Instagram login Page

In this demo, i will show you how to create a instagram login page using html and css.

How to create a pulse animation in CSS

In this demo, i will show you how to create a pulse animation using css.

Creating a snowfall animation using css and JavaScript

In this demo, i will show you how to create a snow fall animation using css and JavaScript.

Top Udemy Courses

JavaScript - The Complete Guide 2022 (Beginner + Advanced)
JavaScript - The Complete Guide 2022 (Beginner + Advanced)
116,648 students enrolled
52 hours of video content
$14.99 FROM UDEMY
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
631,582 students enrolled
49 hours of video content
$24.99 FROM UDEMY
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
203,937 students enrolled
31.5 hours of video content
$14.99 FROM UDEMY