Jijil Kakkadathu
Jijil Kakkadathu

Reputation: 361

ERROR in No NgModule metadata found for 'AppModule'. i 「wdm」: Failed to compile

Getting error, after I had updated the cli for implementing Angular4 carousel in Angular5. ERROR in No NgModule metadata found for 'AppModule'. i 「wdm」: Failed to compile.

**Below is the version details.** 

Angular CLI: 6.1.5    
Node: 8.9.4    
OS: win32 x64      
Angular: 5.2.1   
... animations, common, compiler, compiler-cli, core, forms    
... http, language-service, platform-browser    
... platform-browser-dynamic, router    

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.5    
@angular-devkit/build-angular     0.7.5     
@angular-devkit/build-optimizer   0.7.5     
@angular-devkit/build-webpack     0.7.5     
@angular-devkit/core              0.7.5     
@angular-devkit/schematics        0.7.5      
@angular/cli                      6.1.5     
@ngtools/webpack                  6.1.5     
@schematics/angular               0.7.5      
@schematics/update                0.7.5      
rxjs                              5.5.6    
typescript                        2.5.3     
webpack                           4.9.2     

Upvotes: 1

Views: 6125

Answers (3)

Shanil Arjuna
Shanil Arjuna

Reputation: 1135

There is an open issue for angular cli 6.x

Till it gets fixed you can use this workaround , you can add the app.module.ts to the files array in your tsconfig.app.json

 "files": [
      "../src/app/app.module.ts"
]

https://github.com/angular/angular-cli/issues/10516

Upvotes: 1

Suresh Kumar Ariya
Suresh Kumar Ariya

Reputation: 9764

Angular CLI version is 6.x. But the Angular Core library are 5.x. Seems like version mismatch. Try to upgrade Angular from 5 to 6 using https://update.angular.io/

Upvotes: 1

Ayoub k
Ayoub k

Reputation: 8878

The webpack should come as a part of @angular/cli.

npm remove webpack

npm install --save-dev @angular/cli@latest.

This should fix your issue. If this didn't, clear the whole node_modules folder then

npm cache clean --force

npm install

npm install --save-dev @angular/cli@latest

If @angular/cli install fails Retry npm install --save-dev @angular/cli@latest again.

Upvotes: 0

Related Questions