Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Getting [$injector:modulerr] when running from localhost #2297


User avatar
0
terry bentley created

I upgraded to Abp 1.2.1 and can run the application without any problems starting it from within Visual Studio. I tried to deploy it to localhost and when I try to run it as <a class="postlink" href="http://localhost/Cipher">http://localhost/Cipher</a> I get the following error after logging in Uncaught Error: [$injector:modulerr] <a class="postlink" href="http://errors.angularjs.org/1.5.6/$injector/modulerr?p0=app&p1=Error%3A%20">http://errors.angularjs.org/1.5.6/$inje ... rror%3A%20</a>%…c%20(http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.min.js%3A21%3A332) at angular.js:38 at angular.js:4630 at q (angular.js:322) at g (angular.js:4591) at db (angular.js:4513) at c (angular.js:1777) at Ac (angular.js:1798) at fe (angular.js:1683) at HTMLDocument.<anonymous> (angular.js:31018) at i (jquery.min.js:2)

This is not telling me anything of value as far as what might be missing that I can determine. I have turned off debugging both when doing the publish and in the web.config. The angular.js:31018 is a call to angularInit

How do I determine what angular is complaining about?

Thanks...Terry


8 Answer(s)
  • User Avatar
    0
    terry bentley created

    Sorry - above post should have said turned debugging ON not OFF

  • User Avatar
    0
    terry bentley created

    Was able to turn off the minified version of angular by changing the const in ScriptPaths and got a more informative error:

    Error: [$injector:modulerr] Failed to instantiate module app due to: [$injector:nomod] Module 'app' 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. <a class="postlink" href="http://errors.angularjs.org/1.5.6/$injector/nomod?p0=app">http://errors.angularjs.org/1.5.6/$inje ... mod?p0=app</a> minErr/<@http://localhost/Cipher/Scripts/angular.js:68:12 module/<@http://localhost/Cipher/Scripts/angular.js:2101:17 ensure@http://localhost/Cipher/Scripts/angular.js:2025:38 module@http://localhost/Cipher/Scripts/angular.js:2099:14 loadModules/<@http://localhost/Cipher/Scripts/angular.js:4607:22 forEach@http://localhost/Cipher/Scripts/angular.js:322:11 loadModules@http://localhost/Cipher/Scripts/angular.js:4591:5 createInjector@http://localhost/Cipher/Scripts/angular.js:4513:19 bootstrap/doBootstrap@http://localhost/Cipher/Scripts/angular.js:1777:20 bootstrap@http://localhost/Cipher/Scripts/angular.js:1798:12 angularInit@http://localhost/Cipher/Scripts/angular.js:1683:5 @http://localhost/Cipher/Scripts/angular.js:31018:5 n.Callbacks/i@http://localhost/Cipher/libs/jquery/jquery.min.js:2:27446 n.Callbacks/j.fireWith@http://localhost/Cipher/libs/jquery/jquery.min.js:2:28215 .ready@http://localhost/Cipher/libs/jquery/jquery.min.js:2:30006 K@http://localhost/Cipher/libs/jquery/jquery.min.js:2:30368

    <a class="postlink" href="http://errors.angularjs.org/1.5.6/$injector/modulerr?p0=app&p1=%5B%24injector%3Anomod%5D%20Module%20'app'%20is%20not%20available!%20You%20either%20misspelled%20the%20module%20name%20or%20forgot%20to%20load%20it.%20If%20registering%20a%20module%20ensure%20that%20you%20specify%20the%20dependencies%20as%20the%20second%20argument.%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.5.6%2F%24injector%2Fnomod%3Fp0%3Dapp%0AminErr%2F%3C%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A68%3A12%0Amodule%2F%3C%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A2101%3A17%0Aensure%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A2025%3A38%0Amodule%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A2099%3A14%0AloadModules%2F%3C%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A4607%3A22%0AforEach%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A322%3A11%0AloadModules%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A4591%3A5%0AcreateInjector%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A4513%3A19%0Abootstrap%2FdoBootstrap%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A1777%3A20%0Abootstrap%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A1798%3A12%0AangularInit%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A1683%3A5%0A%40http%3A%2F%2Flocalhost%2FCipher%2FScripts%2Fangular.js%3A31018%3A5%0An.Callbacks%2Fi%40http%3A%2F%2Flocalhost%2FCipher%2Flibs%2Fjquery%2Fjquery.min.js%3A2%3A27446%0An.Callbacks%2Fj.fireWith%40http%3A%2F%2Flocalhost%2FCipher%2Flibs%2Fjquery%2Fjquery.min.js%3A2%3A28215%0A.ready%40http%3A%2F%2Flocalhost%2FCipher%2Flibs%2Fjquery%2Fjquery.min.js%3A2%3A30006%0AK%40http%3A%2F%2Flocalhost%2FCipher%2Flibs%2Fjquery%2Fjquery.min.js%3A2%3A30368%0A">http://errors.angularjs.org/1.5.6/$inje ... 3A30368%0A</a>

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    This is a strange case, can you share content of deployed app.js ?

  • User Avatar
    0
    terry bentley created

    Thanks for the offer but the problem appears to be resolved. Not quite sure the full extent of the cause though. Here is my "flawed" process in case it saves others from the same situation: The information in the error from the minified file was terrible so... I switched the Publish on the deployment to Debug mode and the web.config to debug mode so (I thought) the application would use non minified javascript. Still showing cryptic error and determined that I needed to change the ScriptPath to reference the non minified angular.js files to see the "real" error. Error showed that app module was missing. Erroneously thought this was the source of the original error. However, this was caused by the fact that even though the Publish and web.config was debug mode all the non minified javascript files were not being deployed. Therefore, for example, the program was looking for app.js but it did not exist - only the app.min.js existed. When I manually copied the app.js to the deployed folder I got another error caused by yet another missing non minified javascript file. I switch the Publish and web.config back to Release mode expecting the original error and everything worked! So what was the initial cause? Not really sure. During the whole investigative process I rebooted, restarted IIS, cleared various caches,... many time. Hope the error was that something incorrect was cleared from cache. I will keep testing.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi Terry Bentley,

    Thanks for your detailed explanation. It might be related to browser cache, that is the only thing comes to my mind right now.

  • User Avatar
    0
    douglasbustos created

    Hi. I need some help please. I need a solution for my application. Part of code Javascript (for prevent back button) dosn't work in production mode, but en DEBUG mode work fine. Logically that leave unsecure the source code of web application.

    I try with minifier [https://aspnetzero.com/Documents/Development-Guide-Core#bundling-minifying-and-compiling]) but that only work in production mode not in debug mode, then my code for prevent back button dons't work again. The message in error is dont found "app" module in minified file.

    Please please help me.

    Attach my app.js, and my index.js that contain the code for prevent back button.

    The sequence: 1.- Application deployment in DEBUG=FALSE, work all except the code for prevent back button (desktop and mobile browser). Source code is save (obviuslly)

    2.- Change mu deployment DEBUG=TRUE, work all include my code for prevent back button. Source code now is visible and at risk.

    3.- Try to minify the .js files. apparently successfully . And change the line in AppBundleConfig.cs .IncludeDirectory("~/App", ".min.js", true)

    4.- Deploy the new version in DEBUG=FALSE or TRUE, and dont work any. He the error:

    Error: $injector:modulerr Module Error

    Module 'app' 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.

    Please please help me.

  • User Avatar
    0
    douglasbustos created

    It seems that the solution is simpler, here I share it.

    <a class="postlink" href="https://github.com/facultymatt/angular-unsavedChanges">https://github.com/facultymatt/angular-unsavedChanges</a>

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thank you for sharing this @douglasbustos :)