提供角度构建时在非法状态问题中出错 [英] ERROR in Illegal State issue when giving angular build

查看:64
本文介绍了提供角度构建时在非法状态问题中出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个有角度的应用程序.当我使用ng serve正常运行它时,它正在运行而没有任何错误.但是,当我运行ng build --prod时,出现以下错误.

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.

更新:

依赖项:

"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"
}

其他:

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

谢谢...

推荐答案

发现此错误可能是由于组件已在多个模块(例如,在app.modulemy_feature_module.module中)注册的缘故.

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

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

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

这篇关于提供角度构建时在非法状态问题中出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆