Bower在VS2015.3下载错误版本

sne*_*kke 10 jquery bower visual-studio-2015 asp.net-core

我在asp内核1.0项目的VS内部遇到问题.我的bower.json就是这个

{
  "name": "asp.net",
  "private": true,
  "dependencies": {
    "bootstrap": "3.3.6",
    "jquery": "2.2.4",
    "jquery-validation": "1.14.0",
    "jquery-validation-unobtrusive": "3.2.6"
  }
}
Run Code Online (Sandbox Code Playgroud)

但是当我进入凉亭下载的libs时,发现jquery是v3.1.0

/*eslint-disable no-unused-vars*/
/*!
 * jQuery JavaScript Library v3.1.0
 * https://jquery.com/
 *
 * Includes Sizzle.js
 * https://sizzlejs.com/
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * https://jquery.org/license
 *
 * Date: 2016-07-07T21:44Z
 */
Run Code Online (Sandbox Code Playgroud)

我以为这是我的机器,但它发生在三台不同的机器上.难道我做错了什么??

编辑: 我试过这个:

{
  "name": "asp.net",
  "private": true,
  "dependencies": {
    "jquery": "~2.2.4"
  },
  "resolutions": {
    "jquery":  "<=2.2.4"
  }
}
Run Code Online (Sandbox Code Playgroud)

bower.json中配置的唯一包是jquery,仍然安装jquery 3.0.1.为什么凉亭这样做?npm/bower的输出窗口说:

PATH =.\node_modules.bin; C:\ Program Files(x86)\ Microsoft Visual Studio 14.0\Web\External;%PATH%; C:\ Program Files(x86)\ Microsoft Visual Studio 14.0\Web\External\git" C:\ Program Files(x86)\ Microsoft Visual Studio 14.0\Web\External\Bower.cmd"install --force-latest

bower jquery#~2.2.4缓存https://github.com/jquery/jquery-dist.git#2.2.4

bower jquery#~2.2.4验证2.2.4对https://github.com/jquery/jquery-dist.git#~2.2.4

bower jquery extra-resolution不必要的解决方案:jquery#<= 2.2.4

bower jquery#~2.2.4安装jquery#2.2.4

jquery#2.2.4 wwwroot\bower\jquery

bgl*_*lee 6

这是工具仓库中的一个已知问题:

https://github.com/aspnet/Tooling/issues/575

我只是切换到npm,这解决了正确的包版本.


小智 6

我遇到了同样的问题,并成功地解决了它.随Visual Studio 2015一起提供的bower存在问题,可能是在Visual Studio更新之一中引入的.你可以做什么:

  1. 安装Git(依赖)
  2. 安装nodejs
  3. 安装凉亭
  4. 配置Visual Studio选项以使用已安装的nodejs版本
  5. 删除bower缓存文件夹%USERPROFILE%\ AppData\Local\bower

参考:http: //josharepoint.com/2016/05/04/how-to-configure-visual-studio-2015-integration-with-latest-version-of-node-js-and-npm/