我正在尝试使用AOT编译器实现角度应用程序。我跟着文章https://angular.io/guide/aot-compiler。 因此我下载了文件更改后的设置,在使用命令编译项目时创建了tsconfig-aot.json node_modules / .bin / ngc -p tsconfig-aot.json抛出错误
TypeError: this.compiler.analyzeModulesAsync is not a function
at CodeGenerator.codegen (/media/arjun/D/Work/TeachingMaterial/anngularJS/angular_aot2/quickstart/node_modules/@angular/compiler-cli/src/codegen.js:32:14)
at codegen (/media/arjun/D/Work/TeachingMaterial/anngularJS/angular_aot2/quickstart/node_modules/@angular/compiler-cli/src/main.js:13:81)
at Object.main (/media/arjun/D/Work/TeachingMaterial/anngularJS/angular_aot2/quickstart/node_modules/@angular/tsc-wrapped/src/main.js:106:16)
at main (/media/arjun/D/Work/TeachingMaterial/anngularJS/angular_aot2/quickstart/node_modules/@angular/compiler-cli/src/main.js:19:16)
at Object. (/media/arjun/D/Work/TeachingMaterial/anngularJS/angular_aot2/quickstart/node_modules/@angular/compiler-cli/src/main.js:35:5)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
Compilation failed
我的package.json文件依赖项
"@angular/common": "~4.0.0",
"@angular/compiler": "~4.0.0",
"@angular/compiler-cli": "^4.3.0",
"@angular/core": "~4.0.0",
"@angular/forms": "~4.0.0",
"@angular/http": "~4.0.0",
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/platform-server": "^4.3.0",
"@angular/router": "~4.0.0",
"angular-in-memory-web-api": "~0.3.0",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"zone.js": "^0.8.4"
节点版本v7.9.0
OS Ubuntu
请建议我该怎么办才能解决问题?
答案 0 :(得分:0)
问题在于@ angular / compiler-cli和其他angular软件包的版本不匹配。因此,我们建议您在应用程序中将@ angular / compiler-cli软件包安装在与其他angular软件包相同的版本中。
使用“ @ angular / compiler-cli”:“ ^ 4.0.0”,而不是“ @ angular / compiler-cli”:“ ^ 4.3.0”,