When running ng build, an error occurs without providing any specific details like the file name. This project is an ASP.NET Core app with Angular 7.
c:\Users\siva\Myapp\ClientApp>ng build
Date: 2019-08-08T13:22:52.205Z
Hash: 3cf9605e6457ff409625
Time: 6746ms
chunk {main} main.js, main.js.map (main) 671 bytes [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 93.3 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 747 kB [initial] [rendered]
ERROR in No NgModule metadata found for 'AppModule'.
The locally installed packages and their versions are:
npm list --depth=0
+-- @angular-devkit/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7210071b1e165f131c15071e130032425c43415c4b">[email protected]</a>
... (more package information)
The content of the package.json file is as follows:
{
"name": "myapp",
"version": "1.0.0",
"description": "myapp",
"scripts": {
"ng": "ng",
... (more scripts listed)
},
... (more configuration details)
}
The main.ts file contains:
import { enableProdMode } from '@angular/core';
... (content of main.ts)
The app.module.ts file includes:
import { APP_BASE_HREF } from '@angular/common';
... (content of app.module.ts)
I have tried various troubleshooting steps such as deleting the node_modules folder, running npm install, clearing the npm cache using 'npm cache clear --force', and even reinstalling Node.js and the source code from scratch. Despite these efforts, the same error persists. How can I further investigate the root cause of this error?
Additionally, when using the --aot parameter in ng build, a different error occurs:
TypeError: Cannot read property 'flags' of undefined