Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR in Illegal State issue when giving angular build

I am developing an angular application. It is running without any errors when I run it normally using ng serve. But, when I run ng build --prod, it is giving following error.

ERROR in Illegal State: referring to a type without a variable {"filePath":"/Users/admin/Documents/projects/simply-science-web-ui/simply-science/node_modules/@angular/forms/forms.d.ts","name":"NgControlStatusGroup","members":[]}

I could not understand what is the issue. Please help me solve this. Please let me know if any further information is needed.

UPDATE:

dependencies:

"dependencies": {
    "@angular/animations": "~8.1.2",
    "@angular/common": "~8.1.2",
    "@angular/compiler": "~8.1.2",
    "@angular/core": "~8.1.2",
    "@angular/forms": "~8.1.2",
    "@angular/platform-browser": "~8.1.2",
    "@angular/platform-browser-dynamic": "~8.1.2",
    "@angular/router": "~8.1.2",
    "rxjs": "~6.4.0",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
}

Other:

Angular CLI: 8.1.3
Node: 10.16.0
OS: darwin x64
Angular: 8.1.3

Thanks...

like image 382
Sai Avatar asked Aug 26 '19 10:08

Sai


1 Answers

Found this error can be caused by components being registered in multiple modules, for example in app.module and my_feature_module.module.

Temporarily disabling tsconfig.json -> fullTemplateTypeCheck and re-running ng build --prod might show the related component registration errors.

like image 161
Sebastian Wegert Avatar answered Oct 28 '22 17:10

Sebastian Wegert