本文介绍了奇怪的角度版本解决了 bower 安装的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更新我的 Angular 版本,我认为 bower 疯了.

I'm trying to update my angular version, and I think bower went just mad.

我的deps:

    "dependencies": {
    "underscore":"*",
    "momentjs":"~2.2.1",
    "bootstrap": "~3.0.0",
    "jquery": "~1.9.1",
    "jquery.cookie": "*",
    "jquery-ui": "~1.10.3",
    "jquery-file-upload": "*",
    "angular": "~1.2.0-rc.2",
    "angular-route": "~1.2.0-rc.2",
    "angular-resource": "~1.2.0-rc.2",
    "angular-animate": "~1.2.0-rc.2",
    "angular-cookies": "~1.2.0-rc.2",
    "angular-i18n": "~1.2.0-rc.2",
    "angular-bootstrap" : "*",
    "ng-grid": "*",
    "highcharts": "*",
    "highcharts-ng": "*"
},

"devDependencies": {
    "angular-mocks": "~1.2.0-rc.2",
    "angular-scenario": "~1.2.0-rc.2"
}

这里重要的是:所有 angular 模块都是 1.2.0-rc.2 版本

the important thing here is : all angular modules are version 1.2.0-rc.2

但是当做

bower install

结果如下:

Unable to find a suitable version for angular, please choose one:
1) angular#1.0.8 which resolved to 1.0.8 and has angular-scenario#1.2.0-rc.2 as dependants
2) angular#1.2.0-rc.2 which resolved to 1.2.0-rc.2 and has angular-animate#1.2.0-rc.2, angular-cookies#1.2.0-rc.2, angular-mocks#1.2.0-rc.2, angular-resource#1.2.0-rc.2, angular-route#1.2.0-rc.2, angular-scenario#1.2.0-rc.2 as dependants
3) angular#~1.2.0-rc.2 which resolved to 1.2.0-rc.2 and has tael-web as dependants
4) angular#>=1 which resolved to 1.2.0-rc.2 and has angular-bootstrap#0.6.0 as dependants
5) angular#>=1.0.4 which resolved to 1.2.0-rc.2 and has highcharts-ng#0.0.2 as dependants

bower 似乎认为 angular-scenario 1.2.0-rc2 需要 angular 1.0.8 ... ???

bower seems to think that angular-scenario 1.2.0-rc2 requires angular 1.0.8 ... ???

这实际上只是错误的:https://github.com/angular/bower-angular-scenario/tree/v1.2.0-rc.2

bower.json :

bower.json :

{
  "name": "angular-scenario",
  "version": "1.2.0-rc.2",
  "main": "./angular-scenario.js",
  "dependencies": {
    "angular": "1.2.0-rc.2"
  }
}

我在这里缺少什么?我能做些什么来解决这个问题?需要明确的是:我不想使用交互式冲突解决方法,因为这是在远程 CI 上进行的.我只想强调 * 如何将角度场景 1.2.0-rc2 假设为角度 1.0.8 作为依赖项...

What I am missing here ? What can I do to resolve this ? To be clear : I dont want to use the interactive conflict resolving method, because this is appening on a remote CI. I just want to underscore how the * assume angular scenario 1.2.0-rc2 as angular 1.0.8 as dependency...

谢谢

推荐答案

尝试将此部分添加到您的 bower.json 中:

Try adding this section to your bower.json:

"dependencies": {
  ...
},
"resolutions":{
  "angular": "1.2.0-rc.2"
}

注意:分辨率中的角度版本与依赖项中的版本相同.

Note: angular version in resolutions as same as version in dependencies.

这篇关于奇怪的角度版本解决了 bower 安装的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 14:16