Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force npm to use the jquery 2.1.1

I am asking this question as a beginner on node-npm. My current node_modules has a query version 2.2.0. But in the same project i am using materialize-css which has a datepicker component.

This component runs on jquery 2.1.1. My question is simple.

How can i remove the current jquery [v 2.2.0] from my node_modules and install jquery version [2.1.1] so that the datepicker component works.

like image 615
Prakhar Avatar asked Jan 12 '16 13:01

Prakhar


People also ask

How do I force npm to run?

Execute this command by running the command prompt as Administrator npm install -g windows-build-tools. Run npm install inside the project folder where the package. json file is located, if it doesn't work run: npm install --force.

Can I use jQuery in node JS?

js: We can use jQuery in Node. js using the jquery module. Note: Use the 'jquery' module not the 'jQuery' module as the latter is deprecated.


2 Answers

You can use the npm CLI to install the dependency directly without changing the dependencies yourself in package.json by typing:

npm install [email protected]

like image 52
mtpultz Avatar answered Oct 13 '22 21:10

mtpultz


Add the specific version to your package.json :

"dependencies": {
    "jquery": "2.1.1"
}

Then, run the following command :

npm update
like image 42
xkcd149 Avatar answered Oct 13 '22 20:10

xkcd149