How to find the version of an installed npm package?
source link: https://dev.to/bobbyiliev/how-to-find-the-version-of-an-installed-npm-package-3hfh
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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:
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
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:
├── @cloudflare/[email protected]
├── @stackbit/[email protected]
├── [email protected]
├── [email protected]
└── [email protected]
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:
└─┬ [email protected]
└─┬ [email protected]
└── [email protected] deduped
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.
Recommend
-
5
Spiderable middleware Google, Facebook, Twitter, Yahoo, and Bing and all other crawlers and search engines are constantly trying to view your website. If your website is built on top of the JavaScript framework...
-
9
Node installed.js ver 0.8 but node --version still shows the previous version 0.6.12 advertisements I tried installing node ver 0.8 on my ubun...
-
9
Breaking 'pip install' to smaller steps, so I can modify the package before it is installed advertisements My familiarity with pip ends up with the...
-
8
Check version of Installed Package on UbuntuI find many people asking a question “how do I check a version of an installed package on my Ubuntu/Debian system?, How do I know package versions available on Ubuntu / Debian Linux operating system...
-
8
How to show latest package version in NPMNodeJS’s package manager NPM has a handy feature for listing outdated packages and updating selected packages to the latest version. The MailSlurp web app is built with NodeJS and Vue. We use...
-
8
[Makefile] Check Installed Package Version on Ubuntu Linux December 23,...
-
9
How to find installed text to speech voices on Windows I’m using a Visual Studio Code extension that provides text-to-speech, which I use as part of
-
6
May 18, 2022 Find and manage your installed apps and sites Installing websites as Windows a...
-
1
9 of them are more challenging to remove, it seems
-
1
Newest Android version installed on a mere 5% of devices News
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK