List Installed npm Packages
npm·2 min read·Jan 1, 2025
Being able to list the packages used by a project is quite helpful as it allows developers to better understand how packages are built in general, control the size of their applications, fix package-related bugs or conflicts by downgrading or bumping package versions, replace unmaintained packages, and so on.
List installed packages
List locally installed packages
To output the list of top-level packages installed in the node_modules directory of a project, you can navigate to the project, and run the npm ls command:
$ npm lsExample
For example, this command will show the top-level packages of the website project:
$ npm lswebsite@1.0.0 /Users/rludosanu/Projects/website├── axios@1.4.0└── dayjs@1.11.9List globally installed packages
To output the list of top-level packages installed globally on the system, you can use the npm ls with the -g flag:
$ npm ls -gExample
For example, this command will show the globally installed top-level packages:
Unlock the program 🚀
Pay once, own it forever.
€79
30-day money-back guarantee
- 13 modules
- 113 lessons with full-code examples
- 29 projects with commented solutions
- All future lesson and project updates
- Lifetime access
By submitting this form, you agree to the Terms & Conditions and Privacy Policy.