Wednesday, July 20, 2022

angular: Error: node_modules/ngx-bootstrap/datepicker/bs-datepicker.config.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

 

>PROBLEM

Angular compilation returns:

Error: node_modules/ngx-bootstrap/datepicker/bs-datepicker.config.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.


This likely means that the library (ngx-bootstrap/datepicker) which declares BsDatepickerConfig has not been processed correctly by ngcc, or is not compatible with Angular Ivy. 

Check if a newer version of the library is available, and update if so. 

Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy. 



>SOLUTION


Edit app.module.ts and fix its configuration as follows:


>BEFORE (WRONG)

  imports: [

AlertConfig, 

BsDropdownConfig, 

BsDatepickerConfig

  ],

  providers: [],


>AFTER (RIGHT)

  imports: [

  ],

  providers: [AlertConfig, BsDropdownConfig, BsDatepickerConfig],



>ENV

Angular CLI: 13.2.2

Node: 16.13.1

Package Manager: npm 8.5.4

OS: win32 x64


No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...