问题
So, I generated a fresh angular-fullstack with TypeScript, MongoDB, Bootstrap, Bootstrap UI, Authentication Boilerplate, Twitter and Google OAuth, Grunt, Jasmine, HTML, CSS, and UI-Router for the settings.
After I ran npm install and bower install. There were some unmet dependencies, so I installed
- TypeScript, locally
- Mocha, locally
- Tslint, locally
Also, I was getting an error during build that was resolved by installing grunt-babel@5.0.0, locally.
Now, when I run "grunt serve" It all works just fine, except when I go to the Admin page at http://localhost:9000/admin. There is no list of users. Instead it says, "The delete user and user index api routes are restricted to users with the 'admin' role." All of the links on the navigation bar are dead, except for the app title.
When I check the console I get these two errors:
Uncaught Error: [$injector:nomod] Module 'perfectAlgorithmDrillsApp.auth' 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.
Uncaught Error: [$injector:nomod] Module 'perfectAlgorithmDrillsApp.admin' 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.
I triple-checked. They are not misspelled and they are correctly included in the list of module dependencies.
Further errors arise because the module isn't loaded. Obviously, it can't find the controllers, since those modules aren't loaded.
At this point, I have not added or changed any code.
I've tried a couple things to resolve the situation:
- updating yo and angular-fullstack and then recreating the project from scratch.
- wrapping those "missing" modules in IFFE's.
- I updated node.js to the latest LTS version
More Details:
- I am running everything on OSX El Capitan 10.11.2
- I'm running node version 4.2.6, npm version 2.14.12, yeoman 1.6.0
- in the yo.rc file it says the generator version is "3.3.0-beta.0"
- I have mongod running.
- I'm doing my work in WebStorm, but I haven't used anything that's built in. It's all been command line.
- The TypeScript is being compiled correctly, as the .tmp directory looks good.
- I made sure grunt-cli is installed.
Thanks so much for the help. Let me know if you need any more details.
回答1:
I too had this exact problem. The long answer (plus some other answers to questions you might not be asking for yet or possibly ever) is here, but in short, replace var module = /\.module\.js$/;
with var module = /[\w/]+.module.ts$/;
inside Gruntfile.js.
If that doesn't work, try going here to see the whole thread on this issue.
来源:https://stackoverflow.com/questions/35105628/missing-modules-after-fresh-generation-with-yeomans-angular-fullstack