How to install a specific version of an Npm package
In this tutorial, we are going to learn about how to install a specific version of a node package using npm.
When you install a new package using npm install <package-name>
command it downloads the most recent
(stable) version inside the node_modules
folder and add it to the package.json
file.
Installing a specific version
To install a specific version of a package, we need to use the npm install <packagename>
command followed by the @version-number
npm install angular@6.2.1
The version has three numbers (6.2.1) which are major.minor.patch based on the semantic versioning rules.
For global installs, you need to add -g
flag.
npm install -g @angular/cli@6.2.1