oauthjs/angular-oauth2

Failed to instantiate module {}

elynnaie opened this issue · 6 comments

I am getting the following error when attempting to instantiate the module:

Uncaught Error: [$injector:modulerr] Failed to instantiate module MyApp due to:
Error: [$injector:modulerr] Failed to instantiate module angular-oauth2 due to:
Error: [$injector:modulerr] Failed to instantiate module {} due to:
Error: [ng:areq] Argument 'module' is not a function, got Object

I've installed with bower:

  • angular-cookies: 1.4.8
  • query-string: ^4.2.3
  • angular-oauth2: ^4.0.0
  • angular: 1.4.8

Each of the files are loaded with commonjs. Due to Angular silliness, I had to perform the following workaround to get angular requireable (unsure if this is related to my problem):

require('public/bower_components/angular/angular'); // Path to angular.js
// Register 'angular' so that angular-oauth2 can require it.
window.require.register('angular', function (exports, require, module) {
    module.exports = angular;
});
require('public/bower_components/angular-oauth2/dist/angular-oauth2');

The error occurs when attempting to register the angular-oauth2 module. Any ideas on what could cause this?

Also getting an 'undefined' error for requireJS.

[$injector:modulerr] Failed to instantiate module angular-oauth2 due to:
[$injector:modulerr] Failed to instantiate module undefined due to:
[ng:areq] Argument 'module' is not a function, got undefined
http://errors.angularjs.org/1.5.8/ng/areq?p0=module&p1=not%20a%20function%2C%20got%20undefined

@denaje @danpaulsmith Did you found the solution? Never tried to run the project using RequireJS.

No, can't say that I have, sorry. Our team has moved on to Angular 2.

Closing it.

I got same error with requirejs, my team can't yet move to angular4

This is still an issue for us.