How to force npm to use jquery 2.1.1

I am asking this question as a newbie to node -npm. My current node_modules has query version 2.2.0. But in the same project, I use materialize-css with the datepicker component.

This component works in jquery 2.1.1. My question is simple.

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

+5
source share
3 answers

Add a specific version to the package.json file

"dependencies": { "jquery": "2.1.1" } 
+12
source

Thanks for helping. I went to the package.json file and added the dependency as

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

after that I did sudo npm update to an existing project and changed the jquery version to 2.1.1. I assume sudo npm install will also have the same effect

0
source

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

npm install jquery@2.1.1

0
source

Source: https://habr.com/ru/post/1240435/


All Articles