Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

angularjs - Strange angular version resolving bug with bower install

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...