如何强制npm使用jquery 2.1.1

时间:2022-01-25 19:42:51

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.

我问这个问题是node-npm的初学者。我当前的node_modules的查询版本为2.2.0。但是在同一个项目中,我使用的是具有datepicker组件的materialize-css。

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

该组件在jquery 2.1.1上运行。我的问题很简单。

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.

如何从我的node_modules中删除当前的jquery [v 2.2.0]并安装jquery版本[2.1.1],以便datepicker组件工作。

3 个解决方案

#1


14  

Add the specific version to your package.json file

将特定版本添加到package.json文件中

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

#2


1  

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

您可以使用npm CLI直接安装依赖项,而无需通过键入以下内容来自行更改package.json中的依赖项:

npm install jquery@2.1.1

npm install jquery@2.1.1

#3


0  

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

谢谢你的帮助。我去了我的package.json文件并添加了依赖项

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

after this I did sudo npm update to the existing project and it changed the jquery version to 2.1.1. I assume sudo npm install would also have same effect

在此之后,我对现有项目进行了sudo npm更新,并将jquery版本更改为2.1.1。我认为sudo npm install也会有同样的效果

#1


14  

Add the specific version to your package.json file

将特定版本添加到package.json文件中

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

#2


1  

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

您可以使用npm CLI直接安装依赖项,而无需通过键入以下内容来自行更改package.json中的依赖项:

npm install jquery@2.1.1

npm install jquery@2.1.1

#3


0  

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

谢谢你的帮助。我去了我的package.json文件并添加了依赖项

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

after this I did sudo npm update to the existing project and it changed the jquery version to 2.1.1. I assume sudo npm install would also have same effect

在此之后,我对现有项目进行了sudo npm更新,并将jquery版本更改为2.1.1。我认为sudo npm install也会有同样的效果