NPM – Check the installed version of a npm package
In this post will show you how to check the installed version of a npm package in your machine.
As you known, a npm package can be either installed locally in a project or installed as a global package. So you need to know where your package you want to check is installed so that you can use the appropriate command.
Let’s follow the below guides to check the installed version of a npm package.
1. npm package installed locally in a project
If you want to check the installed version of a npm package which installed locally in a project, you will need run the below command at root project directory where contains npm_modules
folder.
npm list <package-name>
For example:
You want to check the version of react-scripts
package in your project, you will run the below command:
$ npm list react-scripts
`-- react-scripts@0.9.5
2. npm package installed as a global package
If you want to check the version of a npm package which installed as a global package, you simply open your terminal/CMD and run the bellow command.
npm list -g <package-name>
The above command has added -g
flag.
For example:
You want to check the installed version of global create-react-appt
package, you will run the below command:
$ npm list -g create-react-app
`-- create-react-app@3.4.1