Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PrimeNG error ConfirmationService has not been processed correctly by ngcc, or is not compatible with Angular Ivy

I'm using PrimeNG 11 with angular 11 as per this configuration:

  "dependencies": {
"@angular/animations": "^11.2.2",
"@angular/cdk": "^11.2.1",
"@angular/common": "^11.2.2",
"@angular/compiler": "^11.2.2",
"@angular/core": "^11.2.2",
"@angular/forms": "^11.2.2",
"@angular/platform-browser": "^11.2.2",
"@angular/platform-browser-dynamic": "^11.2.2",
"@angular/router": "^11.2.2",
"@auth0/angular-jwt": "^5.0.2",
"bootstrap": "^5.0.0-beta2",
"primeicons": "^4.1.0",
"primeng": "^11.2.3",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"typescript-map": "^0.1.0",
"zone.js": "^0.10.3"  }

After importing the module & service to use the confirm dialog component we got an error

This likely means that the library (primeng/api) which declares ConfirmationService has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is a

vailable, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

The import lines

import {ConfirmDialogModule} from 'primeng/confirmdialog'; import {ConfirmationService} from 'primeng/api';

I tried

  1. Delete node-modules and run npm update
  2. Adding this line to scripts in package.json ["postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"]

None of these worked with me.

Can somebody please help with this ?

like image 330
jsmin Avatar asked Nov 17 '25 09:11

jsmin


1 Answers

I found that I was importing ConfirmationService instead of adding it to the providers. After adding it to providers it worked just fine. The error message was totally misleading.

like image 190
jsmin Avatar answered Nov 19 '25 11:11

jsmin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!