Install a specific version of npm package

Installing a specific version of an npm package, something that will help to solve compatibility issues.

You can use the below command for installing a specific version of a npm package.

npm install <package>@<version>

Example

Below will install the current verion of the axios.

npm install axios

If you want to install the verions 0.22.0 you can use the below.

npm install axios@0.22.0

For installing it as global package, run the following command:

npm install -g axios@0.22.0

For listing all the previous version of a package. You can do it with npm view <package> versions.

npm view axios versions

For tree-structured list of all your locally installed packages, including their dependencies, run the following command:

npm list

For viewing the packages inserted globally, run the following command:

npm list -g

For viewing the verion of a specific package, run the following command:

npm list axios    

Read More