by Sai gowtham

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

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
26,545 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
221,520 students enrolled
44 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
114,575 students enrolled
21 hours of video content
View Course