Angular AOT 在编译时失败(带有 angular/compiler-cli 的东西) [英] Angular AOT failing at compilation (something with angular/compiler-cli)

查看:19
本文介绍了Angular AOT 在编译时失败(带有 angular/compiler-cli 的东西)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

完成文档页面上的 AOT 教程后,我正在尝试编译 angular 2 AOT 并收到以下错误

After going through the AOT tutorial on the Docs page, I am trying to compile angular 2 AOT and am getting the following error

"node_modules/.bin/ngc" -p tsconfig-aot.json

TypeError: compiler.AnimationParser is not a constructor
at Function.CodeGenerator.create (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\codegen.js:108:400)
at codegen (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\main.js:7:36)
at Object.main (C:\Projects\NeilKellyClient4\node_modules\@angular\tsc-wrapped\src\main.js:37:16)
at Object.<anonymous> (C:\Projects\NeilKellyClient4\node_modules\@angular\compiler-cli\src\main.js:16:9)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
Compilation failed

我在这一点上被卡住了.angular/compiler-cli 抛出此错误的任何原因?

I am getting stuck at this point. Any reason why angular/compiler-cli is throwing this error ?

推荐答案

如你所说,似乎是版本冲突.我遇到了同样的问题,必须重新安装包才能使用指定的版本.我建议安装发布版本并重新运行,直到你得到你想要的.无论如何,我遇到了同样的错误,2.1.2 对我有用.

As you say, it appears to be a version conflict. I had the same issue, and had to reinstall the package to get it to work, with the version specified. I would suggest installing the release versions and re-running until you get what you wanted. For what it's worth, I had same error, and 2.1.2 worked for me.

npm install @angular/compiler-cli@2.1.2 --save-dev

至于为什么,我推测软件包版本不同步.尝试运行 npm list --depth=0 并查看是否弹出任何内容.可能会提示什么不正常.

As to why, I would speculate the package versions are out of sync. Try running npm list --depth=0 and see if anything pops up. Might give a hint as to what's out of whack.

这篇关于Angular AOT 在编译时失败(带有 angular/compiler-cli 的东西)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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