"ng build" showing "ERROR in No NgModule metadata found for 'AppModule'" instead of detailed root errors
See original GitHub issueπ Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- xi18n
- run
- config
- help
- version
- doc
Is this a regression?
Yes, the previous version in which this bug was not present was: ....Description
In JIT build mode (AOT=false), βng buildβ keeps reporting βERROR in No NgModule metadata found for βAppModuleββ instead of showing detailed root issues - Lambda not supported in βapp-routing.module.tsβ
π¬ Minimal Reproduction
Root issue - app-routing.module.ts
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: '',
loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
}
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
π₯ Exception or Error
The error caught during grabbing AppModuleβs metadata. In the error details, it says the error will be reported, but it didnβt. Without debugging, I only see error 'ERROR in No NgModule metadata found for βAppModuleβ reported by Angular CLI.
π Your Environment
Angular CLI: 10.0.5
Node: 12.16.1
OS: win32 x64
Angular: 10.0.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1000.5
@angular-devkit/build-angular 0.1000.5
@angular-devkit/build-optimizer 0.1000.5
@angular-devkit/build-webpack 0.1000.5
@angular-devkit/core 10.0.5
@angular-devkit/schematics 10.0.5
@angular/cli 10.0.5
@ngtools/webpack 10.0.5
@schematics/angular 10.0.5
@schematics/update 0.1000.5
rxjs 6.6.2
typescript 3.9.7
webpack 4.43.0
Anything else relevant?
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"charset": "utf8",
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strict": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"paths": {
"app/*": [
"src/app/*"
]
}
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"preserveWhitespaces": false,
"strictMetadataEmit": true,
"strictInjectionParameters": true,
"strictTemplates": true
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Angular 2 : No NgModule metadata found - Stack Overflow
During ng serve the error I got was: ERROR in Error: No NgModule metadata found for 'AppModule'. at NgModuleResolver.resolveΒ ...
Read more >Angular β All Possible Solutions for 'No NgModule' - Stack 24/7
The error βNo NgModule metadata found for 'AppModule'β could be caused by various reason: Moving Angular project folder.
Read more >NgModules - Angular
@NgModule takes a metadata object that describes how to compile a component's template and how to create an injector at runtime. It identifies...
Read more >ERROR in No NgModule metadata found for 'AppModule ...
I am getting [ng] ERROR while ionic serve in No NgModule metadata found for 'AppModule' this error. I searched a lot but not...
Read more >Angular Modules and NgModule - Complete Guide
It turns out that adding Home to the declarations of HomeModule does not automatically make the component visible to any other modules thatΒ ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @alan-agius4 , great! Thank you very much for looking into my issues and pointing me to the correct cause! Really appreciate it!
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.