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

3,443 views
Skip to first unread message

Maureen Moore

unread,
Jun 26, 2020, 6:38:18 PM6/26/20
to Angular and AngularJS discussion
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. 

maninder singh Kumar

unread,
Jun 26, 2020, 6:41:09 PM6/26/20
to ang...@googlegroups.com
Isn't it @angular/material/forms ?

regards .. willy


--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/effd5564-1277-416d-8ea5-f06219b040c2o%40googlegroups.com.

Maureen Moore

unread,
Jun 26, 2020, 6:56:21 PM6/26/20
to Angular and AngularJS discussion
Thanks, Maninder. I tried ng update @angular/material/forms but got the error: Package '@angular/material/forms' is not a registry package identifer.
To unsubscribe from this group and stop receiving emails from it, send an email to ang...@googlegroups.com.

maninder singh Kumar

unread,
Jun 26, 2020, 7:26:12 PM6/26/20
to ang...@googlegroups.com
My mistake, I might have guided you wrong. I checked up GitHub and came up to removing the angular-tabs-component. Not sure if that helps but here's what else I found

Npm ci works sometimes though you might want to look up documentation for it. I have never tried it.

Regds ...willy

Sent from my iPad

> On 27-Jun-2020, at 4:26 AM, Maureen Moore <maka...@gmail.com> wrote:
>
> FormBuilder {

Maureen Moore

unread,
Jun 26, 2020, 7:46:46 PM6/26/20
to Angular and AngularJS discussion
Thanks, Maninder. I googled removing the angular-tabs-component but I couldn't find anything about it. Can you be more specific as to how to remove it?

Maureen Moore

unread,
Jun 27, 2020, 7:37:19 PM6/27/20
to Angular and AngularJS discussion
I deleted the FormGroup and FormBuilder imports and that fixed the problem but I need those imports for my forms. Is there an import that I could use instead?

Maureen Moore

unread,
Jun 28, 2020, 7:36:58 PM6/28/20
to Angular and AngularJS discussion
The solution was to take FormGroup out of app.module.ts and just put it in my component.ts file alone.

Sander Elias

unread,
Jun 28, 2020, 11:47:08 PM6/28/20
to Angular and AngularJS discussion
Hi Maureen,

I'm glad you found your solution. As a rule of thumb, only import things where you need them.
Only add things to angular modules that really need to be there. That is usually only if the Angular compiler is complaining about missing something. (for example, you need to include the formsModule if you are using the formGroup in one of your components.)

Regards
Sander

Maureen Moore

unread,
Jun 29, 2020, 7:45:36 AM6/29/20
to Angular and AngularJS discussion
Thanks, Sander. I don't know how to post a reply without all of the preceding posts attached.
Reply all
Reply to author
Forward
0 new messages