Strange angular version resolving bug with bower install

核能气质少年 提交于 2019-11-27 17:19:35

问题


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

My 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"
}

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

But when doing

bower install

here is the result :

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 seems to think that angular-scenario 1.2.0-rc2 requires angular 1.0.8 ... ???

which is actually just false : https://github.com/angular/bower-angular-scenario/tree/v1.2.0-rc.2

bower.json :

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

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...

thanks


回答1:


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.




回答2:


I got the same problem with the latest bower version.

You can just do as the bower output prompts: Prefix the choice with ! to persist it to bower.json to choose one from the options provided. Then your bower.json will be updated with an additional "resolutions": { ... } block then the problem will be solved.




回答3:


Instead of:

"angular": "~1.2.0-rc.2"

Try:

"angular": "=1.2.0-rc.2"

Might not be the right way to do it however but it solved a similar issue in my project.



来源:https://stackoverflow.com/questions/18922511/strange-angular-version-resolving-bug-with-bower-install

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!