Angular – The library (@angular/forms) which declares FormBuilder has not been processed correctly by ngcc

angular

I get the following error when I execute ng serve:

ERROR in node_modules/@angular/forms/forms.d.ts:1616: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 (@angular/forms) which declares FormBuilder 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.

1616 export declare class FormBuilder {
~~~~~~~~~~~
node_modules/@angular/forms/forms.d.ts:2148: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 (@angular/forms) which declares FormGroup 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.

2148 export declare class FormGroup extends AbstractControl {
~~~~~~~~~

I tried deleting the node_modules folder and re-installing it. I tried updating the library @angular/forms. I tried running ng build first. I tried editting the angular.json folder with "scripts": {
"postinstall": "ngcc –properties es2015 browser module main –first-only –create-ivy-entry-points" I tried running npm ci in the terminal. I tried some other things that I don't remember too. I am on a Windows operating system.

Best Answer

The solution was to take FormGroup out of app.module.ts and just put it in my component.ts file alone

Related Topic