首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >角AOT编译失败(有角/编译器的东西-cli)

角AOT编译失败(有角/编译器的东西-cli)
EN

Stack Overflow用户
提问于 2016-11-14 22:39:21
回答 2查看 1.1K关注 0票数 2

在浏览了Docs页面上的AOT教程之后,我正在尝试编译角2 AOT,并得到以下错误

代码语言:javascript
复制
"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

我被困在这点上了。为什么角/编译器-cli会抛出这个错误?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-11-15 01:04:03

正如你所说,这似乎是一个版本冲突。我也有同样的问题,必须重新安装包才能让它工作,并指定版本。我建议安装发行版并重新运行,直到你得到你想要的。值得的是,我也犯了同样的错误,2.1.2为我工作。

代码语言:javascript
复制
npm install @angular/compiler-cli@2.1.2 --save-dev

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

票数 1
EN

Stack Overflow用户

发布于 2016-11-17 09:05:32

我摆脱它的方法是对所有的角包使用2.2.0,包括编译器-cli。然后,按照2.2.0的要求,再次执行npm install来重新加载所有包依赖项,并且它工作了。下面是package.json的一部分:

代码语言:javascript
复制
"dependencies": {
    "@angular/common": "~2.2.0",
    "@angular/compiler": "~2.2.0",
    "@angular/compiler-cli": "^2.2.0",
    "@angular/core": "~2.2.0",
    "@angular/forms": "~2.2.0",
    "@angular/http": "~2.2.0",
    "@angular/platform-browser": "~2.2.0",
    "@angular/platform-browser-dynamic": "~2.2.0",
    "@angular/platform-server": "^2.2.0",
    "@angular/router": "~3.2.0",
    "@angular/upgrade": "~2.2.0",
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40599035

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档