How to use‘npm ls’ command in NPM
The npm ls command is used to list installed packages. It shows a tree view of all installed packages in the current project, along with their dependencies.
- -g flag indicates that you want to list globally installed packages.
- –depth=1 option limits the depth of the dependency tree. In this case,
--depth=1
limits the output to only the top-level packages and their direct dependencies.
Syntax:
npm ls -g --depth=1
Output
How to Get a List of Globally Installed NPM Packages in npm ?
Learning how to retrieve a list of globally installed NPM packages is essential for developers managing their Node.js environment. Utilizing npm, the Node Package Manager, enables users to efficiently manage packages across projects.
This article will guide you through getting access to global NPM packages, which will further help you to enhance your development efficiency.
Table of Content
- Using ‘npm list’ command
- Using ‘npm ls’ command