【问题标题】:Angular2 AoT Compilation Error: createAotCompiler is not a functionAngular2 AoT 编译错误:createAotCompiler 不是函数
【发布时间】:2016-11-23 18:52:10
【问题描述】:

我正在尝试在一个非常基本的应用程序上进行 AoT 编译,但在 Windows 中出现此错误,我是否缺少任何包,因为我没有使用 angular-cli 启动

> TypeError: compiler.createAotCompiler is not a function
>         at Function.CodeGenerator.create (...\node_modules\@angular\compiler-cli\src\codegen.js:78:36)

节点版本:5.2.0

"dependencies": {
    "@angular/common": "^2.2.1",
    "@angular/compiler": "^2.2.1",
    "@angular/compiler-cli": "^2.2.2",
    "@angular/core": "^2.2.1",
    "@angular/forms": "^2.2.1",
    "@angular/http": "^2.2.1",
    "@angular/platform-browser": "^2.2.1",
    "@angular/platform-browser-dynamic": "^2.2.1",
    "@angular/platform-server": "^2.2.2",
    "@angular/router": "^3.2.1",
    "@angular/upgrade": "^2.2.1",
    "angular-in-memory-web-api": "^0.1.15",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.8",
    "rxjs": "^5.0.0-rc.4",
    "systemjs": "^0.19.41",
    "zone.js": "^0.6.26"
  },
  "devDependencies": {
    "@types/core-js": "^0.9.34",
    "@types/node": "^6.0.48",
    "systemjs-builder": "^0.15.34",
    "typescript": "^2.0.10"
  }

【问题讨论】:

  • 对你没有帮助,但这不限于windows,我在linux上也是这样,我确实使用angular-cli启动

标签: angular angular2-aot


【解决方案1】:

我认为您遇到这种情况是因为角度模块相互依赖之间的版本不匹配。

您的依赖项的顶部应该是这样的,以匹配编译器 cli 的版本 2.2.2。

"@angular/common": "^2.2.2",
"@angular/compiler": "^2.2.2",
"@angular/compiler-cli": "^2.2.2",
"@angular/core": "^2.2.2",
"@angular/forms": "^2.2.2",
"@angular/http": "^2.2.2",
"@angular/platform-browser": "^2.2.2",
"@angular/platform-browser-dynamic": "^2.2.2",
"@angular/platform-server": "^2.2.2",
"@angular/router": "^3.2.2",
"@angular/upgrade": "^2.2.2",

【讨论】:

  • 这为我修好了
猜你喜欢
  • 2017-02-15
  • 2017-11-18
  • 2017-03-30
  • 2017-01-21
  • 2017-09-23
  • 2017-01-22
  • 1970-01-01
  • 1970-01-01
  • 2017-07-21
相关资源
最近更新 更多