安装后修复 Bower 中的版本问题 Angular Material

fixing version problems in bower after installing Angular Material

我有一个项目正在使用 angular 1.4 版。我通过 bower 安装了 angular material,然后收到以下错误:

Uncaught TypeError: angular.module(...).info is not a function

我读到这与我正在使用的 angular 版本有关,所以我将 angular 和 angular-animate 更新为 1.6。然而,这并没有解决问题。我试了 运行 bower update 还是出现上面的错误。

当我 运行 bower 更新时,我收到以下警告...

Resort to using angular#~1.4.2 which resolved to angular#1.4.14
Code incompatibilities may occur.

这是我的 bower.json 文件的内容:

{
  "name": "node-template",
  "version": "0.0.0",
  "main": [
    "./public/styles/*.css",
    "./public/scripts/*.js"
  ],
  "dependencies": {
    "angular-animate": "1.6",
    "angular-sanitize": "~1.4.2",
    "angular-messages": "~1.4.2",
    "bootstrap-sass": "~3.3.5",
    "jquery": "~2.1.4",
    "angular": "1.6",
    "angular-ui-router": "~0.2.15",
    "angular-bootstrap": "~2.5.0",
    "angular-google-chart": "~0.1.0",
    "velocity": "~1.4.2",
    "animate.css": "~3.5.2",
    "angular-file-saver": "~1.1.3",
    "ng-file-upload": "~12.2.13",
    "ng-img-crop": "ngImgCrop#~0.3.2",
    "angularfire": "~2.3.0",
    "angular-material": "~1.1.4"
  },
  "devDependencies": {
    "angular-mocks": "~1.4.2"
  },
  "overrides": {},
  "resolutions": {
    "jquery": "~2.1.4",
    "angular": "~1.4.2"
  }
}

bower 是在告诉我我正在使用 1.4 版吗?我不明白为什么它不能解决我遇到的版本问题?

编辑:

这是我升级到 angular 1.5 后的新 bower.json:

{
  "name": "node-template",
  "version": "0.0.0",
  "main": [
    "./public/styles/*.css",
    "./public/scripts/*.js"
  ],
  "dependencies": {
    "angular-animate": "1.4",
    "angular-sanitize": "~1.4.2",
    "angular-messages": "~1.4.2",
    "bootstrap-sass": "~3.3.5",
    "jquery": "~2.1.4",
    "angular": "1.5",
    "angular-ui-router": "~0.2.15",
    "angular-bootstrap": "~2.5.0",
    "angular-google-chart": "~0.1.0",
    "velocity": "~1.4.2",
    "animate.css": "~3.5.2",
    "angular-file-saver": "~1.1.3",
    "ng-file-upload": "~12.2.13",
    "ng-img-crop": "ngImgCrop#~0.3.2",
    "angularfire": "~2.3.0",
    "angular-material": "~1.1.4"
  },
  "devDependencies": {
    "angular-mocks": "~1.4.2"
  },
  "overrides": {},
  "resolutions": {
    "jquery": "~2.1.4",
    "angular": "1.5"
  }
}

您已安装 Angular 1.4.14。查看 bower.json 的 Angular Material,包所需的 AngularJS 的最低版本是 1.5,这可能就是您遇到错误的原因。不能更新到 AngularJS 1.5 吗?

否则,我建议您安装与 1.4.x

兼容的旧版本 Angular Material

我看到的错误...

angular.module(...).info is not a function

...似乎在 angular-aria 的版本(angular-material 需要)比 angular 的版本更新时出现。通过将 angular-aria 设置为与 angular 相同的版本,我设法让我的构建再次运行。