#Npm install package with version syntax how to
Hope you found this article helpful.Offline_boltQuick Start Introduction to Node.js A brief history of Node.js How to install Node.js How much JavaScript do you need to know to use Node.js? Differences between Node.js and the Browser You can also use npm commands to find outdated packages or to find unused dependencies in npm and to remove those npm packages too in order to keep your project optimized. You can use npm commands to find and install the latest version of a package available too. npm view jquery versions Example showing the npm command to get all the version numbers of a packageĪs you can see, it is quite simple to install specific version of npm package or to install the latest version of a package too. However, when you use the “versions” (plural) keyword, you get the list of all the version numbers of the package as per the npm registry.įor example, to get all the versions of the jquery package available in the npm registry, we can run the following command to see the list of all the version numbers of jquery as per the npm registry. So when you use the “version” keyword, it would show the latest version number. If you notice, the only difference between the previous two commands is the word “version” being plural. On the other hand, if you would like to list all the versions of a package available on the npm registry, then you can run the following command npm view versions You can do so by running the following command: npm view versionįor example, say you wanted to know which is the latest version of ReactJs available as per the npm registry, you can run the following command npm view react version Example showing the npm view command How to get all versions of package available on npm registry? While you can use the npm install command to install the latest version, there is another command ( npm view) that can be used to get the version number of the latest package available. Please note that both these commands can be used along with the -save and -save-dev etc flags too whenever required.Īlternatively, you can also use the npm view command to get the latest version number of the package and pass that version number How to get the latest npm package version number available on npm registry? On the other hand, if you would like to install the latest version of an npm package, use the same command but instead of specifying the version number, use the “latest” keyword like: npm install example, to install the latest version of React, the command would be npm install Example showing npm command to install the latest version of a package from the npm repository.
![npm install package with version syntax npm install package with version syntax](https://media.geeksforgeeks.org/wp-content/uploads/npm-install-nodemon-globally.png)
How to install the latest version of a package in npm? If you notice, the command is very similar to the basic command to install a package, however, the only difference is the that follows the package name as a suffix. In order to install a specific version of npm package run the npm install command along with the package name followed by the version number prefixed with the at symbol Here is the syntax for the same: npm install example, let’s say I wanted to install React version 17.0.1, then the command would be : npm install Example showing npm command to install specific version of package How to install an exact or specific version of npm package? 4 How to get all versions of package available on npm registry?.3 How to get the latest npm package version number available on npm registry?.
![npm install package with version syntax npm install package with version syntax](https://appcircle.io/wp-content/uploads/2020/06/React-Native-Build-Workflow-Appcircle.png)
![npm install package with version syntax npm install package with version syntax](https://uploads.sitepoint.com/wp-content/uploads/2020/01/1579180139nvm_3.png)