Error: Module 'ngCordova' is not available

When I attempt to build and run an ionic app using ngCordova in the emulator on OS X 10.10, I get the following error:

0     821371   error    Error: [$injector:modulerr] Failed to instantiate module conFusion due to:
[$injector:modulerr] Failed to instantiate module ngCordova due to:
[$injector:nomod] Module 'ngCordova' 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.4.3/$injector/nomod?p0=ngCordova
http://192.168.0.10:8100/lib/ionic/js/ionic.bundle.js:13380:32
http://192.168.0.10:8100/lib/ionic/js/ionic.bundle.js:15270:32
ensure@http://192.168.0.10:8100/lib/ionic/js/ionic.bundle.js:15194:45
module@http://192.168.0.10:8100/lib/ionic/js/ionic.bundle.js:15268:20
http://192.168.0.10:8100/lib/ionic/js/ionic.bundle.js:17674:35
...

But as far as I can see everything for the ngCordova install is done according to http://ngcordova.com/docs/install/ .

For instance:
an extract from my index.html file:

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>
    <script src="lib/ionic/js/angular/angular-resource.min.js"></script>
    
    <!-- ngCordova -->
    <script src="lib/ngCordova/dist/ng-cordova.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

And an extract from my app.js file:

angular.module('conFusion', ['ionic', 'ngCordova', 'conFusion.controllers','conFusion.services'])

.run(function($ionicPlatform, $rootScope, $ionicLoading, $cordovaSplashscreen, $timeout ) {
  $ionicPlatform.ready(function() {
...
    $timeout(function(){
                $cordovaSplashscreen.hide();
      },20000);
  });

In case it is relevant, the command line “ionic info” gives:

Your system information:

Cordova CLI: 6.1.1
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
ios-deploy version: 1.8.6 
ios-sim version: 5.0.8 
OS: Mac OS X El Capitan
Node Version: v4.4.3
Xcode version: Xcode 7.2.1 Build version 7C1002 

The one thing odd about this is that I am actually running on Mavericks, not El Capitan.

Running “cordova platform ls” gives:

cordova platform ls
Installed platforms:
  ios 4.1.1
Available platforms: 
  amazon-fireos ~3.6.3 (deprecated)
  android ~5.1.1
  blackberry10 ~3.8.0
  browser ~4.1.0
  firefoxos ~3.6.3
  osx ~4.0.1
  webos ~3.7.0

From what I can see ngCordova is properly installed, but when the build happens for the simulator, the file “ng-cordova.js” is not getting moved to the build folder for some reason.

Any help would be appreciated!

I´m also learning and got this message sometimes try adding to index.html the path of the controller.js like <script src="path/controller.js"></script>

Yes my index.html also references app.js, controller.js, and services.js . Those are ok and work. That is not the problem here. It seems to be something to do with ngCordova and possibly the version of the operating system.

I have found a working solution, but I still don’t know the root cause.

If I copy the file “projectDir”/bower_components/ngCordova/dist/ng-cordova.js to the location (creating directories as needed for ngCordova and dist): “projectDir”/www/lib/ngCordova/dist/ng-cordova.js then things worked. I would have thought that would happen automatically as part of some install step.