0

I have an AngularJS application, which is used inside an existing website.

something like this:

<div ng-app="configurator" ng-controller="SomeController as someController" data-auth="some-jwt-token" class="app-wrapp">...</div>

The website is using requireJS for their JavaScript stuff. And this is where my app breaks with following error:

mnty.1464947369.js:65 Uncaught Error: Mismatched anonymous define() module: function (){return factory()}
http://requirejs.org/docs/errors.html#mismatchmakeError @ mnty.1464947369.js:65v @ mnty.1464947369.js:65o @ mnty.1464947369.js:65requirejs @ mnty.1464947369.js:65(anonymous function) @ mnty.1464947369.js:70fetchPlugins @ mnty.1464947369.js:70process @ mnty.1464947369.js:70mount @ mnty.1464947369.js:70(anonymous function) @ main_3-21-6.js:149u @ mnty.1464947369.js:66fireWith @ mnty.1464947369.js:66ready @ mnty.1464947369.js:66a @ mnty.1464947369.js:65
app-bundled.js:6 Uncaught Error: [$injector:modulerr] Failed to instantiate module configurator due to:
Error: [$injector:modulerr] Failed to instantiate module rzModule due to:
Error: [$injector:nomod] Module 'rzModule' 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.5.5/$injector/nomod?p0=rzModule

Some of used modules use UMD in their build, but most not. This is the key problem I think. How can I solve this issue?

(the AngularJS app ist bundled in a single JS-file and is included in footer of the page)

dkoch
  • 474
  • 1
  • 3
  • 15
  • 1
    Will you please show us code of your configuration js file ?? – Keshav Jul 11 '16 at 07:13
  • This question is very poorly written. There are multiple errors caused by different problems. I've closed against a question which deals with your first error message ("Mismatched anonymous define") take care of that, include a [mcve] in your question, and then we can reopen. Right now, the lack of MCVE has caused you to get 3 answers that did not fix the issue. – Louis Jul 11 '16 at 10:32

3 Answers3

0

I think the problem is with the load order of your modules, as you can see here:

Error: [$injector:nomod] Module 'rzModule' is not available! You either misspelled the module name or forgot to load it.

Check that this module is getting loaded into angular before you load configurator module.

RecuencoJones
  • 2,747
  • 3
  • 22
  • 21
  • The module contains UMD, so it is using requireJS and not the global angularJS loader, therefore angularjs don't know about it. And this is my problem. – dkoch Jul 11 '16 at 08:31
  • Hm, I see, then can you require rzModule just before creating your module? Also, can you share the repo or where does this rzModule come from? – RecuencoJones Jul 11 '16 at 10:12
0

you are using ng-app="configurator" and the error showing

Error: [$injector:nomod] Module 'rzModule' is not available! You either misspelled the module name or forgot to load it.

So module name should be same.

Durgpal Singh
  • 11,481
  • 4
  • 37
  • 49
-1

I have to agree with 6uitar6reat6od and Durgpal Singh, you might also have a JS file with a define method which conflicts with require js, to solve this you need to properly configure this file within your require configuration section