我正在尝试将 ASP.NET Core 与 NPM、Bower 和 Gulp 一起使用。 在 Bower 配置文件中,我将 jQuery 版本设置为 2.2.3,但编译器运行带有 --force-latest 标志的 Bower.cmd。 这会安装最新的 jQuery 版本 3.1.0,导致与 Bootstrap 3.6 不兼容。 截至目前,我认为没有办法解决这个问题。
日志:
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 jquery#2.2.3 --force-latest --save
bower jquery#>=1.8 cached https://github.com/jquery/jquery-dist.git#3.1.0
bower jquery#>=1.8 validate 3.1.0 against https://github.com/jquery/jquery-dist.git#>=1.8
bower jquery#~2.2.3 cached https://github.com/jquery/jquery-dist.git#2.2.4
bower jquery#~2.2.3 validate 2.2.4 against https://github.com/jquery/jquery-dist.git#~2.2.3
bower jquery#1.9.1 - 2 cached https://github.com/jquery/jquery-dist.git#2.2.4
bower jquery#1.9.1 - 2 validate 2.2.4 against https://github.com/jquery/jquery-dist.git#1.9.1 - 2
bower jquery#2.2.3 cached https://github.com/jquery/jquery-dist.git#2.2.3
bower jquery#2.2.3 validate 2.2.3 against https://github.com/jquery/jquery-dist.git#2.2.3
bower jquery#>= 1.7.2 cached https://github.com/jquery/jquery-dist.git#3.1.0
bower jquery#>= 1.7.2 validate 3.1.0 against https://github.com/jquery/jquery-dist.git#>= 1.7.2
bower jquery extra-resolution Unnecessary resolution: jquery#>= 1.7.2
bower font-awesome extra-resolution Unnecessary resolution: font-awesome#4.6.1
bower jquery#2.2.3 install jquery#2.2.3
jquery#2.2.3 wwwroot\lib\jquery
我面临同样的问题。 相关: https :
我自己刚刚经历过这个问题。 作为解决方法,您可以打开命令提示符并使用:
bower install jQuery#2.2.4 --save
TFS 错误#241382
另一个临时黑客,可能是更改bower.cmd
以从参数列表中删除--force-latest
字符串。
我的 Visual Studio 2015.3 安装中的文件bower.cmd
位于C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External
。
你应该更换:
@"%~dp0\node" "%~dp0\node_modules\bower\bin\bower" %*
和:
ECHO OFF
set params=%*
ECHO %params% | %WINDIR%\system32\FIND "--force-latest" >nul &
IF ERRORLEVEL 0 (call set params=%%params:--force-latest=%%%)
@"%~dp0\node" "%~dp0\node_modules\bower\bin\bower" %params%
上面这段代码将检查参数,如果--force-latest
存在,将被删除,然后使用清除的参数字符串执行 bower。
我通过切换到安装了 Windows 的 GIT 而不是使用 VS 来“修复”这个问题。 见http://stackoverflow.com/questions/37584520/bootstrap-3-3-6-jquery-2-2-4-version-exception/38460014#38460014
+1 错误修正请修正bower.cmd
是否有关于此问题的更新?
最有用的评论
我通过切换到安装了 Windows 的 GIT 而不是使用 VS 来“修复”这个问题。 见http://stackoverflow.com/questions/37584520/bootstrap-3-3-6-jquery-2-2-4-version-exception/38460014#38460014