Ngx-Bootstrap and Angular 9 ModuleWithProviders Error

5k Views Asked by At

I get the error below

ERROR in node_modules/ngx-bootstrap/popover/popover.module.d.ts:3:23 - error NG6005: 
PopoverModule.forRoot returns a ModuleWithProviders type without a generic type argument. 
Please add a generic type argument to the ModuleWithProviders type.
If this occurrence is in library code you don't control, please contact the library authors.

I just added Ngx-Bootstrap's Popover Module and imported PopoverModule.forRoot(). This seems to be Angular 9 incompatibility. How to solve this?

4

There are 4 best solutions below

0
Char On

It's so petty how I solved this error.

I simply run ng add ngx-bootstrap --component popover.

It says:

Skipping installation: Package already installed
Unknown option: '--component'
Unknown option: 'popover'

But when I served the project, it ran successfully anyway.

0
basilkot On

you need add the following script into your package.json

{
  "scripts": {
    "postinstall": "ngcc"
  }
}

and then run npm i

see description here

0
Dmitriy Danylov On

This issue should be fixed in latest version, which correctly works with Angular 9 - in 6.0.0.
Also, it supports Angular 10.

0
mabdullahse On

Noe: This can also be resolved by specifying complete path

import { PopoverModule } from 'ngx-bootstrap/popover';