简体   繁体   English

为什么Bower总是下载v 1.5.9-build.5086 + sha…的Angular版本?

[英]Why Bower always downloads angular version of v 1.5.9-build.5086+sha…?

I am using bower.json to manage my front end dependencies.. no matter however i specify the version of angular in bower i end up getting different version of angular library... Many of the functionality of my code are from previous version of angulars so the functions like $http.post.success() are depracted here and the code does not work. 我正在使用bower.json来管理我的前端依赖项。.无论如何,我在bower中指定了angular的版本,我最终得到了不同版本的angular库。因此此处不介绍$ http.post.success()之类的功能,因此代码不起作用。 I need angular v 1.4.8 but it always downloads some other v1.5.9.build version. 我需要angular v 1.4.8,但它总是下载其他v1.5.9.build版本。 Here is how i tried downloading the package from bower.json 这是我尝试从bower.json下载软件包的方法

1) Mentioning the versions only.. 1)仅提及版本。

"dependencies": {
"angular": "1.4.8",
"jquery": "2.1.4"
 },
"resolutions": {
"jquery": "2.1.4",
"angular": "1.4.8"

2) I tried this way as well giving the full path of the repo in github 2)我也尝试过这种方式,并在github中给出了仓库的完整路径

"dependencies": {
"angular": "https://github.com/angular/bower-angular.git#1.4.8",
"jquery": "2.1.4"
 },
"resolutions": {
"jquery": "2.1.4",
"angular": "https://github.com/angular/bower-angular.git#1.4.8"

Any help would be greatly appreciated 任何帮助将不胜感激

So in my case apparently the problem was git from Visualt Studio Web Tools located at 因此,以我为例,问题显然出在位于

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git

With it, bower tries to install correct versions, but if you look into the bower cache you can see that actual downloaded files don't match. 有了它,bower会尝试安装正确的版本,但是如果您查看bower缓存,您会发现实际下载的文件不匹配。

Solutions 解决方案

  • Install Git for Windows 安装Windows版Git
  • Delete %USERPROFILE%\\AppData\\Local\\bower 删除%USERPROFILE%\\ AppData \\ Local \\ bower
  • Restart Visual Studio 重新启动Visual Studio
  • Delete wwwroot/lib and Restore bower packages 删除wwwroot / lib并还原Bower软件包

You might need to change the point the path of current git.exe in VS 您可能需要在VS中更改当前git.exe的路径

for that: 为了那个原因:

Tools>Options>ProjectsandSolutions>ExternalTools

See the original answer here https://stackoverflow.com/a/38460014/1505521 在这里查看原始答案https://stackoverflow.com/a/38460014/1505521

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM