角度模块必须与angularJS本身具有相同的版本

时间:2014-08-23 19:53:58

标签: angularjs

当我安装angularJS 1.2.16和其他一些角度模块也是版本1.2.16并且我想将我的angularJS 1.2.16更新为1.2.23这会有效吗?

如果是,为什么我会遇到这样的问题:angularJS版本对于角度模拟或ui-router是不正确的?

或者我没有正确地解释它?

C:\test>bower install angular#1.2.23 --save
bower angular#>= 1.0.8          cached git://github.com/angular/bower-angular.git#1.2.23
bower angular#>= 1.0.8        validate 1.2.23 against git://github.com/angular/bower-angular.git#>= 1.0.8
bower angular#1.2.16            cached git://github.com/angular/bower-angular.git#1.2.16
bower angular#1.2.16          validate 1.2.16 against git://github.com/angular/bower-angular.git#1.2.16
bower angular#1.2.23            cached git://github.com/angular/bower-angular.git#1.2.23
bower angular#1.2.23          validate 1.2.23 against git://github.com/angular/bower-angular.git#1.2.23

Unable to find a suitable version for angular, please choose one:
    1) angular#1.2.16 which resolved to 1.2.16 and is required by angular-mocks#1.2.16
    2) angular#>= 1.0.8 which resolved to 1.2.23 and is required by angular-ui-router#0.2.10
    3) angular#1.2.23 which resolved to 1.2.23

Prefix the choice with ! to persist it to bower.json


[?] Answer:

更新

{
  "name": "test",
  "version": "0.0.0",
  "dependencies": {
    "angular-ui-router": "~0.2.10",
    "angular": "1.2.23",
    "jquery": "~2.1.1",
    "bootstrap": "~3.2.0"
  },
  "devDependencies": {
    "angular-mocks": "1.2.16",
    "angular-scenario": "1.2.16"
  },
  "appPath": "app",
  "resolutions": {
    "angular": "1.2.23"

1 个答案:

答案 0 :(得分:0)

  1. 是的,angular和ng模块需要具有相同的版本。它可能会有用,如果它们不是,但你没有保证,它可能是一个奇怪的错误来源。

  2. 您的bower.json中可能有一个条目请求角度模拟#1.2.16,这取决于angularjs 1.2.16。请发布您的bower.json确认

  3. 您可以更新bower.json:

    "angular-mocks": "1.2.23",
    "angular-scenario": "1.2.23"