ERROR in node_modules/@angular/common/http/http.d.ts:2801:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class
2801 export declare class HttpClientModule {
The basic NgModulelinkAt the top are the import statements. The next section is where you configure the @NgModule by stating what components and directives belong to it ( declarations ) as well as which other modules it uses ( imports ).
An NgModule can export a combination of its own declarations, selected imported classes, and imported NgModules. Don't bother re-exporting pure service modules. Pure service modules don't export declarable classes that another NgModule could use.
Declarable is a class type that you can add to the declarations list of an NgModule. The class types such as components, directives, and pipes comes can be declared in the module.
BrowserModulelink Exports required infrastructure for all Angular apps. Included by default in all Angular apps created with the CLI new command. Re-exports CommonModule and ApplicationModule , making their exports and providers available to all apps.
restart your server...
terminate server for windows
ctrl + C
start again
ng serve
I had the same issue.
I was going through comments here https://github.com/angular/angular/issues/35399 for solution.
I simple ran ng serve --prod
and the error was gone. After that I even ran ng serve
.
Other solutions proposed are
"enableIvy": false
to compilerOptions in tsconfig.app.jsonIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With