How to check the version of an installed npm package
In this post we will give you information about How to check the version of an installed npm package. Hear we will give you detail about How to check the version of an installed npm packageAnd how to use it also give you demo for it if it is necessary.
we are going to learn about how to check the version of a installed npm package and its dependencies.
Installed version of all packages
To check the installed version of all npm packages in your project, you can use the npm listcommand.
npm list
Output:
├─┬ express@4.17.1│ ├─┬ accepts@1.3.7│ │ ├─┬ mime-types@2.1.26│ │ │ └── mime-db@1.43.0│ │ └── negotiator@0.6.2│ ├── array-flatten@1.1.1│ ├─┬ body-parser@1.19.0│ │ ├── bytes@3.1.0│ │ ├── content-type@1.0.4 deduped│ │ ├── debug@2.6.9 deduped│ │ ├── depd@1.1.2 deduped│ │ ├─┬ http-errors@1.7.2│ │ │ ├── depd@1.1.2 deduped│ │ │ ├── inherits@2.0.3│ │ │ ├── setprototypeof@1.1.1 deduped│ │ │ ├── statuses@1.5.0 deduped│ │ │ └── toidentifier@1.0.0│ │ ├─┬ iconv-lite@0.4.24│ │ │ └── safer-buffer@2.1.2│ │ ├── on-finished@2.3.0 deduped│ │ ├── qs@6.7.0 deduped
Note: The npm list command doesn’t only show the installed version of packages, but also their dependencies (version).
For globally installed packages, you can use the npm list -g command.
Installed version of a particular package
To check the installed version of a particular package, you can use the npm list command by specifying a package name.
Example:
npm list express
Output:
node-project@1.0.0 /Users/saigowtham/Desktop/node-project└── express@4.17.1
If you want to check the latest version of a package available in npm repository, you can usethe npm view package-name version command.
npm view express version
Output:
4.17.1
Hope this code and post will helped you for implement How to check the version of an installed npm package. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs
