给出角度构建时非法状态问题中的错误

Sai*_*que 4 typescript angular-cli angular

我正在开发一个角度应用程序。当我使用ng serve. 但是,当我运行时ng build --prod,它给出了以下错误。

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":[]}
Run Code Online (Sandbox Code Playgroud)

我不明白这是什么问题。请帮我解决这个问题。如果需要任何进一步的信息,请告诉我。

更新:

依赖:

"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"
}
Run Code Online (Sandbox Code Playgroud)

其他:

Angular CLI: 8.1.3
Node: 10.16.0
OS: darwin x64
Angular: 8.1.3
Run Code Online (Sandbox Code Playgroud)

谢谢...

小智 21

发现这个错误可能是由于组件在多个模块中注册引起的,例如在app.module和 中my_feature_module.module

暂时禁用tsconfig.json -> fullTemplateTypeCheck并重新运行ng build --prod可能会显示相关的组件注册错误。