Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 19, 2022 09:26 am GMT

How to find the version of an installed npm package?

Introduction

npm is a package manager for Node.js. It is used to install and manage packages for your JavaScript projects. npm is open source and was initially released in 2009. The npm repository is a collection of open-source packages and tools for Node.js.

Check npm version

Let's quickly check the version of npm that we are using:

npm -v# Output:8.11.0

If you don't see the version number, you need to install npm first:

Downloading and installing Node.js and npm

Check the version of the installed npm packages

Once you have installed npm, you can check the versions of the installed packages for your project:

npm list

The output will look something like this depending on the installed packages:

Check the version of the installed npm package globally

The -g flag is used to check the global packages. The output will be the same as the output of the npm list command, except that it will only show the global packages.

npm list -g

Example output:

Check the versions of the dependencies of your packages

If you want to check not only the versions of your packages but also their dependencies, you can use the --depth option:

npm list --depth=1

This will show you the versions of your packages and their dependencies.

Check the version of a specific package

You can also check the version of a specific package by adding the package name to the command:

npm list pg

Output:

Conclusion

Using the npm list command is a good way to check the versions of the installed packages.

For more information on what the latest version of a package is, you can use the npm info <package> command.

For more information, you can visit the official documentation at docs.npmjs.com.


Original Link: https://dev.to/bobbyiliev/how-to-find-the-version-of-an-installed-npm-package-3hfh

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To