使用--prod构建Angular 5时出错

时间:2018-03-15 05:50:05

标签: angular

以下是我的开发环境的ng -v输出

Angular CLI: 1.6.7
Node: 8.9.4
OS: win32 x64
Angular: 5.0.3
... animations, common, compiler, core, forms, http
... language-service, platform-browser, platform-browser-dynamic
... router

@angular/cli: 1.6.7
@angular/compiler-cli: 5.2.1
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.28
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.7
@schematics/angular: 0.1.17
typescript: 2.4.2
webpack: 3.10.0

当我使用以下内容构建app时,会提到它旁边的输出

ng build:它构建没有任何问题

ng build --aot:它是没有任何问题的构建

ng build --prod:我收到了以下错误

ERROR in TypeError: compiler_1.isFormattedError is not a function at 
syntaxErrorToDiagnostics(E:\Project\Client\Project1\ClientAPP\ClientAPP\
node_modules\@angular\compiler-cli\src\transformers\program.js:798:25)
at AngularCompilerProgram._addStructuralDiagnostics(E:\Project\Client\ 
Project1\ClientAPP\ClientAPP\node_modules\@angular\compiler- 
cli\src\transformers\program.js:485:49) at 
AngularCompilerProgram._createProgramOnError 
(E:\Project\Client\Project1\ClientAPP\ClientAPP\node_modules\@angular\
compiler-cli\src\transformers\program.js:477:18) 
at E:\Project\Client\Project1\ClientAPP\ClientAPP\node_modules\@angular\
compiler-cli\src\transformers\program.js:151:48
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

这可能是什么原因?

谢谢! 萨米尔

0 个答案:

没有答案