Unknown provider: googleAnalyticsProvider <- googleAnalytics

Hey,

I have a project that is using cordova-plugin-google-analytics plugin with Ionic framework.
I switched to a new Linux system after working on OS X for a couple of months.

On the old system the project runs flawlessly but on the new system I can’t get it started.
The code is identical on both systems and no changes have been made.

I’m trying to run the development environment with the ionic serve command and the client console throws me the following exception:

4     836947   error    Uncaught Error: [$injector:unpr] Unknown provider: googleAnalyticsProvider <- googleAnalytics
http://errors.angularjs.org/1.4.3/$injector/unpr?p0=googleAnalyticsProvider%20%3C-%20googleAnalytics, http://192.168.1.26:8100/lib/ionic/js/ionic.bundle.js, Line: 13241

The plugin version is:

cordova-plugin-google-analytics 1.7.4 “Google Universal Analytics Plugin”

I also tried using version 0.8.1 (That is working on my old system)

google-analytics.js

var Analytics;

Analytics = function($cordovaGoogleAnalytics) {
  this.setTrackerWithId = function(trackId) {
    return document.addEventListener("deviceready", (function() {
      window.analytics.startTrackerWithId(trackId);
    }), false);
  };
  this.setTrackView = function(screenTitle) {
    return document.addEventListener("deviceready", (function() {
      window.analytics.trackView(screenTitle);
    }), false);
  };
  return void 0;
};

angular.module('stCommons').service('googleAnalytics', Analytics);
  • Tried to remove and add the plugin
  • Tried to remove and add the platforms

Reviewed:

System info:

Cordova CLI: 6.5.0 
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v7.5.0
Xcode version: Not installed

use this plugin