Angular cli build prod : TypeError: Cannot read property 'kind' of undefined

标签 angular typescript angular-cli

我尝试使用 Angular CLI 构建项目 ng build --prod我收到这个错误:

ERROR in TypeError: Cannot read property 'kind' of undefined



如果我不使用 --prod我没有收到任何错误

完整错误:
ERROR in TypeError: Cannot read property 'kind' of undefined
    at isParameterPropertyDeclaration (node_modules/typescript/lib/typescript.js:13445:88)
    at Object.filter (node_modules/typescript/lib/typescript.js:469:31)
    at transformClassMembers (node_modules/typescript/lib/typescript.js:70813:20)
    at createClassDeclarationHeadWithoutDecorators (node_modules/typescript/lib/typescript.js:70665:110)
    at visitClassDeclaration (node_modules/typescript/lib/typescript.js:70584:19)
    at visitTypeScript (node_modules/typescript/lib/typescript.js:70432:28)
    at visitorWorker (node_modules/typescript/lib/typescript.js:70227:24)
    at sourceElementVisitorWorker (node_modules/typescript/lib/typescript.js:70252:28)
    at saveStateAndInvoke (node_modules/typescript/lib/typescript.js:70165:27)
    at sourceElementVisitor (node_modules/typescript/lib/typescript.js:70237:20)
    at visitNodes (node_modules/typescript/lib/typescript.js:67751:48)
    at Object.visitLexicalEnvironment (node_modules/typescript/lib/typescript.js:67784:22)
    at visitSourceFile (node_modules/typescript/lib/typescript.js:70521:53)
    at saveStateAndInvoke (node_modules/typescript/lib/typescript.js:70165:27)
    at transformSourceFile (node_modules/typescript/lib/typescript.js:70147:27)
    at transformSourceFileOrBundle (node_modules/typescript/lib/typescript.js:70127:20)

Angular 版本:
Angular CLI: 8.3.3
Node: 12.9.0
OS: darwin x64
Angular: 9.0.0-next.5
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.0-next.3
@angular-devkit/build-angular      0.900.0-next.3
@angular-devkit/build-optimizer    0.900.0-next.3
@angular-devkit/build-webpack      0.900.0-next.3
@angular-devkit/core               9.0.0-next.3
@angular-devkit/schematics         8.3.3
@angular/cdk                       8.1.4
@angular/cli                       8.3.3
@angular/http                      8.0.0-beta.10
@angular/material                  8.1.4
@angular/material-moment-adapter   8.1.4
@ngtools/webpack                   9.0.0-next.3
@schematics/angular                8.3.3
@schematics/update                 0.803.3
rxjs                               6.5.3
typescript                         3.6.3
webpack                            4.39.3

谢谢。

最佳答案

现在记住 TypeScript 3.6.4 已经发布。 不过,可以阅读下面没有真正起作用的内容。

typescript <= 3.6.3提出这个问题,Handle parentless nodes in isParameterPropertyDeclaration .

如果您安装 3.7 ( dev 或新的 beta ),它会编译得很好。

注意:如果您收到 ERROR在构建时,关于 TS 版本,只需通过 tsconfig 禁用它.
用于该用途 disableTypeScriptVersionCheck

"angularCompilerOptions": {
  "disableTypeScriptVersionCheck": true
},
"compilerOptions": {
 ...

如果出现任何其他问题,请关注评论的聊天。

关于Angular cli build prod : TypeError: Cannot read property 'kind' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57891605/

相关文章:

typescript - Angular 2 和模板 : Unterminated string literal. 在第 6 列 24

angular - 在 Progressive Web App (Angular2) 上导入 Material 的 sidenav 问题

javascript - 如何在 ng2-Charts 中将 X 轴标签包装成多行(X 轴标签格式)?

html - 当鼠标悬停在 html/CSS/angular/bootstrap 中时显示树的完整长文本行(嵌套的 HTML 列表)

javascript - 如何从子上下文访问类属性

angular - 无法在 Safari 9.1.2 中加载资源 : Observable. js.map

angular - 如何使用 CLI 创建特定版本的 Angular 项目?

angular - 如何对 AG-Grid 中标题名称为空的列进行排序

angular - 如何在 Angular 中将表单控件重置为原始状态?

node.js - Typescript - 无法扩充模块