No NgModule metadata found for 'Uc'
Versions
Angular CLI: 1.7.3 Node: 6.11.4 OS: win32 ia32
Angular: 5.2.0 / 5.2.9
Observed behavior
i tried to update angular 4.4.4 to Angular 5.x.x. first i generated new project 'ng new dummy' to get a current package.json. so, i used Angular version 5.2.0 .
looks all okay. after this, i used 'ng build' and 'ng build --prod'.
after 'ng build': bundles are generated, my app is loading. all fine.
after 'ng build --prod': bundles are generated, but the app doesn't load. an error is thrown in the main.xxxxx.bundle.js.
this is the error:
Uncaught Error: No NgModule metadata found for 'Uc'. at e.resolve (main.b3264a59000bf30acd4d.bundle.js:1) at e.getNgModuleMetadata (main.b3264a59000bf30acd4d.bundle.js:1) at e._loadModules (main.b3264a59000bf30acd4d.bundle.js:1) at e._compileModuleAndComponents (main.b3264a59000bf30acd4d.bundle.js:1) at e.compileModuleAsync (main.b3264a59000bf30acd4d.bundle.js:1) at e.compileModuleAsync (main.b3264a59000bf30acd4d.bundle.js:1) at e.bootstrapModule (main.b3264a59000bf30acd4d.bundle.js:1) at Bc (main.b3264a59000bf30acd4d.bundle.js:1) at ApplicationCache.window.applicationCache.window.applicationCache.oncached (main.b3264a59000bf30acd4d.bundle.js:1)
Desired behavior
dev and prod build should be loading correctly.
Mention any other details that might be useful (optional)
maybe are the dependencies of my package.json helpful:
"dependencies": {
"@angular/animations": "^5.2.9",
"@angular/common": "^5.2.9",
"@angular/compiler": "^5.2.9",
"@angular/core": "^5.2.9",
"@angular/forms": "^5.2.9",
"@angular/http": "^5.2.9",
"@angular/platform-browser": "^5.2.9",
"@angular/platform-browser-dynamic": "^5.2.9",
"@angular/router": "^5.2.9",
"reflect-metadata": "^0.1.12",
"core-js": "^2.4.1",
"rxjs": "^5.5.6",
"zone.js": "^0.8.19",
"hammerjs": "^2.0.8",
"ng2-validation": "^4.2.0",
"ng2-pdf-viewer": "^4.1.2",
"ng2-nouislider": "1.7.7",
"nouislider": "10.0.0",
"exif-js": "^2.3.0",
"notify-js-legacy": "^0.4.1",
"hyphenation.de": "^0.2.1",
"pdfjs-dist": "1.9.489",
"jquery": "3.2.1",
"bootstrap-timepicker": "0.5.2",
"bootstrap": "3.3.7",
"bootstrap-datepicker": "1.7.1",
"eonasdan-bootstrap-datetimepicker": "4.17.47",
"ng2-simple-timer": "^1.3.3",
"moment": "^2.19.1",
"moment-timezone": "0.4.0",
"node-forge": "^0.7.4",
"ng2-dnd": "^5.0.2"
},
"devDependencies": {
"@angular/cli": "~1.7.3",
"@angular/compiler-cli": "^5.2.9",
"@angular/language-service": "^5.2.9",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"@types/core-js": "~0.9.46",
"@types/angular": "^1.6.43",
"@types/angular-animate": "^1.5.9",
"@types/angular-cookies": "^1.4.5",
"@types/angular-mocks": "^1.5.11",
"@types/angular-resource": "^1.5.14",
"@types/angular-route": "^1.3.5",
"@types/angular-sanitize": "^1.3.7",
"@types/hammerjs": "^2.0.35",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.6.2",
"webpack": "^3.1.0",
"ajv": "^6.0.0",
"worker-loader": "^1.1.1"
}
I did a new install with cli, now when I try ng build --prod then I get above error "@angular/cli": "~1.7.1", $> node -v --> v8.1.2 Windows
I am having the same exact issue.
same here.
following instruction from this issue: https://github.com/angular/angular-cli/issues/8798 DID NOT help me: npm remove webpack npm install --save-dev @angular/cli@latest. npm cache clean --force npm install npm install --save-dev @angular/cli@latest remove npm-packages and reinstall them.
build without --prod flag works fine.
I can confirm this behavior...
Is there a fix or workaround for this?
none of the suggestion on the net so far works, including:
- clone repo and install everything fresh
- force remove all related folders files and reinstall
- all with: npm cache clean --force
Everything works fine WIHOUT --prod
I had the same issue when upgrading my project from angular 5 to angular 6. Only the two letters were,
No NgModule metadata found for 'Cm'
at one point, and at another,
No NgModule metadata found for 'Fy'
I believe I found my error. I decided to create a new angular project and to repetitively publish it as I added npm packages, to see when the error would occur. When I looked up a tutorial on how to migrate my new project from angular 5 to 6, I followed the steps found here: http://www.talkingdotnet.com/upgrade-angular-5-app-angular-6-visual-studio-2017/
When I compared my old project to the working new one, I noticed two major differences. One was that when I had migrated my old project to angular 6, I had missed this step:
"Once this is done, remove rxjs-compat. This package is required to get backwards compatibility with RxJS previous to version 6. But, it is no longer required now, so let’s remove it using the following command: "
npm uninstall rxjs-compat
Hope that helps you guys!
I believe that was the cause of the error. I also found was a segment of unnecessary code which probably didn't cause the problem, but I'm going to mention anyway just in case.
I had accidentally duplicated this line of code, in my main.ts file.
platformBrowserDynamic().bootstrapModule(AppModule)
platformBrowserDynamic(providers).bootstrapModule(AppModule)
.catch(err => console.log(err));
The lines of code looked slightly different, so I hadn't noticed the duplication.
Are you still able to reproduce this issue with the latest version?
Closing as no further feedback has been provided by the reporter.
If the problem persists, please file a new issue and ensure you provide all of the required information when filling out the issue template.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.