Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class in angular 8

Tags:

angular8

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 {
like image 285
Kapil Avatar asked Feb 15 '20 14:02

Kapil


People also ask

Where is NgModule located?

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 ).

What kind of components can be included in exports of NgModule?

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.

What is declarable in angular?

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.

What is the use of BrowserModule in angular?

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.


2 Answers

restart your server...

terminate server for windows

ctrl + C

start again

ng serve
like image 81
Shuvo Avatar answered Dec 06 '22 06:12

Shuvo


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 --prodand the error was gone. After that I even ran ng serve.
Other solutions proposed are

  • Ensure that the tsconfig.json of your library has set "importHelpers": true
  • Add "enableIvy": false to compilerOptions in tsconfig.app.json
like image 25
lokesh kumar Avatar answered Dec 06 '22 06:12

lokesh kumar