Better Stack Team
Updated on March 11, 2024
To list npm user-installed packages, you can use the npm list
command in the terminal. By default, this command will show a tree-like structure of all installed packages for the current project. If you want to see a list of globally installed packages (user-installed), you can add the -g
flag.
Here are the commands:
List User-Installed Packages Locally:
Copied!
npm list
This command will display a tree structure of locally installed packages for the current project.
List User-Installed Packages Globally:
Copied!
npm list -g --depth=0
g
flag indicates global packages.-depth=0
flag specifies that you only want to see top-level packages without their dependencies.
Alternatively, you can use the following command to list globally installed packages without the dependencies:
Copied!
npm -g ls --depth=0
These commands will output a list of globally installed packages along with their versions. If you want more details, you can remove the --depth=0
flag, and npm will display the entire dependency tree.
Remember that the exact command might vary slightly based on your operating system and terminal environment.
How to install a previous exact version of a NPM package?
To install a specific version of an npm package, you can use the npm install command along with the package name and the desired version number. Here's the syntax:npm install <package_name>@<versi...
Questions
How do I pass command line arguments to a Node.js program and receive them?
In Node.js, you can pass command line arguments to your script the same as you would for any other command line application. Simply type your arguments after the script path separated with a space ...
Questions
Is there a map function for objects in Node.js?
In JavaScript, the map function is typically used with arrays to transform each element of the array based on a provided callback function. If you want to achieve a similar result with objects, you...
Questions
How can I uninstall npm modules in Node.js?
To uninstall npm modules (packages) in Node.js, you can use the npm uninstall command followed by the name of the module you want to remove. Here are a few examples:Uninstalling a Local Module:To...
Questions
Make your mark
Join the writer's program
Are you a developer and love writing and sharing your knowledge with the world? Join our guestwriting program and get paid for writing amazing technical guides. We'll get them to the rightreaders that will appreciate them.
Write for usWriter of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack
Write a script, app or project on top of Better Stack and share it with the world.Make a public repository and share it with us at our email.
[email protected]or submit a pull request and help us build better products for everyone.
See the full list of amazing projects on github