How To Get a List of Globally Installed NPM Packages in NPM? Last Updated : 15 Oct, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report To get a list of globally installed NPM packages, there are several methods you can use depending on the level of detail and format you need. Below, we’ll cover two main approaches that utilize different commands to retrieve this information: npm list and npm ls.Table of ContentApproach 1: Using 'npm list' command:Approach 2: Using 'npm ls' commandApproach 1: Using 'npm list' command:To get a list of globally installed npm packages, we can use npm list command in our terminal or command prompt. The npm list command is used to list installed npm packages. -g flag indicates that you want to list globally installed packages.--depth=0 option specifies the depth of the dependency tree to display. Setting it to 0 ensures that only the top-level packages are listed without their dependencies.Syntax: npm list -g --depth=0Output:Get a List of Globally Installed NPM Packages in npmThis will show the name and version of each globally installed package. The tree-like structure makes it easy to identify the packages you have installed globally.Approach 2: Using 'npm ls' commandAnother approach to list globally installed packages is by using the npm ls command. This command works similarly to npm list but can provide a cleaner, parseable output, which is useful when you need to process the results programmatically or store them in a file.-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=1Outputdisplaying top-level packages along with their immediate dependenciesThis output shows the absolute paths to the globally installed packages, which is particularly useful for scripting or saving the list to a file for later review.ConclusionBoth npm list and npm ls commands are powerful tools for managing globally installed NPM packages.Use npm list when you want a more detailed, tree-like view of installed packages.Use npm ls --parseable when you need a cleaner, simpler format, particularly for scripting or storing the list in a file.These commands make it easy to view, update, or uninstall global packages, helping you manage your Node.js development environment more efficiently. Comment More infoAdvertise with us Next Article How to Force an NPM Package to Install? B bishalpaul34 Follow Improve Article Tags : Web Technologies Node.js Node-npm Similar Reads How to list npm user-installed packages in Node.js? What is Node.js? Node.js is an open source and cross-platform runtime environment for executing JavaScript code outside of a browser. Click here for more. What is npm? Here, "npm" stands for "Node Package Manager" which is the package manager for Node.js and serves as a command-line utility for inte 2 min read How to Find the Version of an Installed NPM Package in Node.js ? NPM is the default package manager for Node.js. NPM manages both internal and external packages or modules used in various Node.js applications. The default packages in NPM may not fulfil all the needs of a developer, so we often require external packages. These can be installed either locally in a 2 min read How to Install GIT by NPM Packages? Git is a library for git written in Node.js which allows for the manipulation of git repositories by the Node.js application. Git (npm), not to be confused with GIT, the version control software is a Node.js port of the now-defunct Git project. It is fairly synchronous as-is, and it allows the devel 2 min read How to Force an NPM Package to Install? Forcing an NPM package to install can be necessary in cases where the dependencies of a package are in conflict or when you need to override existing constraints or force the installation of a specific version. Forcing an NPM package to install refers to using specific commands to bypass version con 3 min read How to Install an NPM Package Directly from GitHub ? Installing npm packages directly from GitHub can be incredibly useful, especially when you need to use a specific version or branch of a package that may not yet be published to the npm registry. This approach allows developers to take advantage of the latest features, bug fixes, or specific package 2 min read How To List Installed Python Packages Working on Python projects may require you to list the installed Python packages in order to manage dependencies, check for updates, or share project requirements with others. In this post, we'll look at numerous techniques for listing the Python packages that are installed on your system.List Insta 5 min read Like