0
votes

In an AngularJS I'm trying to instantiate angular-jwt. But it fails, although I have in my app.js file:

angular.module('xxx', ['ngRoute', 'angular-jwt'])
    .config(config).run(run);

and in my index.html:

...
    <script src="node_modules/angular-route/angular-route.js"></script>
    <script src="node-modules/angular-jwt/dist/angular-jwt.js"></script>
    <script src="angular-app/app.js"></script>
...

Chrome gives the usual error:

Failed to instantiate module xxx due to: Error: [$injector:modulerr] Failed to instantiate module angular-jwt due to: Error: [$injector:nomod] Module 'angular-jwt' 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.

Firefox is pointing to the real reason? It says:

The resource from “http://localhost:3000/node-modules/angular-jwt/dist/angular-jwt.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).

Error: [$injector:modulerr] Failed to instantiate module meanhotel due to:

[$injector:modulerr] Failed to instantiate module angular-jwt due to:

[$injector:nomod] Module 'angular-jwt' 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.

The version of angular-jwt is angular-jwt@0.1.11. Why is it thinking angular-jwt.js is text/html?

1
What do you see when you open that url directly?charlietfl
It fails Cannot GET /node-modules/angular-jwt/dist/angular-jwt.js. Strange, it works for, for example, angular-route.js, in that case, just shows the js file. Then I saw what happened. The path should be node_modules, rather than node-modules! The silliest question ever asked.Pavitx

1 Answers

0
votes

Path problem, I wrote node-modules, when it should be node_modules.