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

时间:2017-07-19 17:54:26

标签: angularjs bower angularjs-material

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

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

我读到这与我正在使用的角度版本有关,所以我更新了角度,然后angular-animate更新为1.6。然而,这并没有解决问题。我试过运行bower update,但我仍然有上述错误。

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

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

2 个答案:

答案 0 :(得分:1)

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

如果不这样做,我建议您安装与1.4.x兼容的旧版Angular Material

答案 1 :(得分:0)

我看到的错误......

angular.module(...).info is not a function
angular-ariaangular-material所需)的版本比angular版本更新时,似乎会出现

....通过将angular-aria设置为与angular相同的版本,我设法让我的构建再次工作。