Search code examples
angularjsbowerangularjs-module

Can't include ngMessages Module in Angularjs application after bower install


I'm having a lot of trouble trying to install and import the angular-messages module in an angularjs project. Here is the error message

Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module ngMessages due to:
Error: [$injector:nomod] Module 'ngMessages' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.6.4/$injector/nomod?p0=ngMessages
    at http://localhost:8000/bower_components/angular/angular.js:66:12
    at http://localhost:8000/bower_components/angular/angular.js:2262:17
    at ensure (http://localhost:8000/bower_components/angular/angular.js:2183:38)
    at module 

As you can see from below, I believe that I've imported the angular messages module properly (in index.html).

I've also included images of the file paths and of my app.js that does the import of ngMessage. Bower versions seem to be ok as well. Any thoughts?

enter image description here

enter image description hereenter image description here

enter image description here


Solution

  • Your version of ng-messages is not compatible with the version of AngularJS. Try strict versions in your dependency configuration:

    {
      "name": "angular-seed",
      "version": "0.0.0",
      "private": true,
      "dependencies": {
        "angular": "1.6.0",
        "angular-route": "1.6.0",
        "angular-loader": "1.6.0",
        "angular-mocks": "1.6.0",
        "angular-messages": "1.6.0"
      }
    }