简体   繁体   English

以 angular 运行 ng build --prod 时编译错误

[英]Compile error when running ng build --prod in angular

I'm getting this error when running ng build --prod in angular.以 angular 运行ng build --prod时出现此错误。

ERROR in ./node_modules/angular-file/fesm2015/angular-file.js Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js): TypeError: Cannot read property 'kind' of undefined ./node_modules/angular-file/fesm2015/angular-file.js 中的错误模块构建失败(来自 ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):类型错误:无法读取未定义的属性“种类”

I don't know whats causing this and how to resolve this.我不知道是什么导致了这个以及如何解决这个问题。

在此处输入图片说明

TypeScript <= 3.6.3 presents this issue TypeScript <= 3.6.3提出了这个问题

If you install 3.7 (dev or the new beta), it will compile fine.如果您安装3.7 (开发版或新测试版),它将编译正常。

Note: if you receive an ERROR on building, regarding the TS version, just disable it via tsconfig .注意:如果您在构建时收到ERROR ,关于 TS 版本,只需通过tsconfig禁用它。 For that use disableTypeScriptVersionCheck为此使用disableTypeScriptVersionCheck

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

Edited:编辑:

Change the angular-devkit version to "0.803.8" (yours seems outdated) and angular/cli at "8.3.8".将 angular-devkit 版本更改为“0.803.8”(您的似乎已经过时)并将 angular/cli 更改为“8.3.8”。

Hope this helps :)希望这可以帮助 :)

[Reference] - Angular cli build prod: TypeError: Cannot read property 'kind' of undefined [参考] - Angular cli build prod:TypeError:无法读取未定义的属性“种类”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM