Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install npm package smaller than any specific version

Let me explain....

Like.. I want to install jQuery package using npm, and the version of jquery is smaller than 3.0.0.

So how can I do it?

like image 797
MohammedAshrafali Avatar asked Aug 09 '17 10:08

MohammedAshrafali


People also ask

How do I downgrade a npm package to a specific version?

To downgrade an npm package, run the npm install <package>@<version> command. You need to provide the version you want to install with the @<version> syntax.

How do I reduce npm version?

The npm program that you used to install packages under the node_modules/ folder is actually just a node package. When you need to downgrade npm , you need to run the npm install -g npm@<version> command followed by the version you want to install.

How do I install a specific version of a package?

Use npm list [package-name] to know the specific latest version of an installed package. Use npm install [package-name]@[version-number] to install an older version of a package. Prefix a version number with a caret (^) or a tilde (~) to specify to install the latest minor or patch version, respectively.


2 Answers

You can install an npm package below a specific version using this:

npm install jquery@">=0.1.0 <3.0.0" // Using a range

npm install jquery@"<3.0.0" // Below a specific version

You can refer to this link for more information: https://docs.npmjs.com/cli/install

like image 85
Chandrakant Thakkar Avatar answered Oct 18 '22 14:10

Chandrakant Thakkar


I think you must update the dependency version in "package.json" (which you required) and then run the "npm install" command.It will update the package with which we added in the "package.json" file. Hope this will fix the issue.

like image 28
ArunJaganathan Avatar answered Oct 18 '22 13:10

ArunJaganathan