tai*_*eye 9 jquery twitter-bootstrap
我想在我的新ASP.Net Core应用程序中使用Bootstrap和JQuery.但是当我尝试运行应用程序时,我遇到错误"Bootstrap的JavaScript需要jQuery版本1.9.1或更高版本,但低于版本3".
我已经使用bower将Bootstrap添加到我的应用程序中,并添加了Bootstrap 3.3.6版,它自动添加了JQuery 2.2.4.问题是,似乎版本2.2.4的JQuery实际上是在3.0.0-rc1版本,这导致Bootstrap验证失败,因为它只接受版本1.9.1但不到版本3的JQuery版本?
我该如何解决这个冲突?Bootstrap是如何与不兼容的JQuery版本打包的?
在这里,您可以在我的解决方案中查看我的文件,显示Bootstrap和JQuery版本:正如您所看到的,还没有安装其他版本的JQuery.
这是我的Html标记的片段
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
</head>
<body>
<h1>HELLOOOO!</h1>
<script type="text/javascript" src="~/lib/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="~/lib/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
这导致Chrome报告"Bootstrap的JavaScript需要jQuery版本1.9.1或更高版本,但低于版本3"
任何帮助将不胜感激!
ama*_*nov 25
我们发现问题的根源是git.exe,C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git它不是真正的Git,而是某种包装器.
通过它,bower尝试安装正确的版本,但是如果你查看bower缓存,你可以看到实际下载的文件不匹配.
例:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External>
bower install jquery#2.2.4
bower jquery#2.2.4 not-cached https://github.com/jquery/jquery-dist.git#2.2.4
bower jquery#2.2.4 resolve https://github.com/jquery/jquery-dist.git#2.2.4
bower jquery#2.2.4 checkout 2.2.4
bower jquery#2.2.4 resolved https://github.com/jquery/jquery-dist.git#2.2.4
bower jquery#2.2.4 install jquery#2.2.4
jquery#2.2.4 bower_components\jquery
Run Code Online (Sandbox Code Playgroud)
检查"%USERPROFILE%\ AppData\Local\bower\cache\packages\35300e45e44dbc6f186ed069533ef0af\2.2.4\dist\jquery.js"的内容:
/*eslint-disable no-unused-vars*/
/*!
* jQuery JavaScript Library v3.1.0
Run Code Online (Sandbox Code Playgroud)
方案:
更新:您可能还需要调整VS外部Web工具设置
正如 Phil 所指出的,这是由 Visual Studio 内置的 Bower 支持引起的。使用这个时,似乎下载了不同版本的JQuery。
为了解决这个问题,我只是使用了正确的 Bower 客户端并通过控制台安装了我的软件包。
| 归档时间: |
|
| 查看次数: |
5025 次 |
| 最近记录: |