Search code examples
angularjsbowerangularjs-material

fixing version problems in bower after installing Angular Material


I have a project which was using angular version 1.4. I installed angular material via bower and then subsequently received the following error:

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

I read this was to do with the version of angular I'm using so I updated angular and then angular-animate to 1.6. However this didn't fix the problem. I tried running bower update but I still have the above error.

When I ran bower update I received the following warning...

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

this is the contents of my bower.json file:

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

Is bower telling me I'm using version 1.4? I don't understand why it cannot resolve the version problems I'm encountering?

Edit:

here is my new bower.json after upgrading to angular 1.5:

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

Solution

  • You have Angular 1.4.14 installed. Looking at the bower.json for Angular Material the minimum version of AngularJS required for the package is 1.5 which is probably why you are having errors. Can you not update to AngularJS 1.5?

    Failing that, I suggest you install an older version of Angular Material that is compatible with 1.4.x