3

angular.ioサイトの AOT コンパイル ガイドに従おうとしていますが、以下に示すコマンドを実行すると、「node_modules/.bin/ngc」 -p tsconfig-aot.json

エラーが発生します

TypeError: compiler.createAotCompiler is not a function
    at Function.CodeGenerator.create (path\node_modules\@angular\compiler-cli\src\codegen.js:78:36)
    at codegen (path\node_modules\@angular\compiler-cli\src\main.js:7:36)
    at Object.main (path\node_modules\@angular\tsc-wrapped\src\main.js:37:16)
    at Object.<anonymous> (path\node_modules\@angular\compiler-cli\src\main.js:14:9)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
Compilation failed

私のAngularの依存関係はコンパイラのバージョンと一致しています(^2.1.2)

"dependencies": {
    "@angular/common": "~2.2.2",
    "@angular/compiler": "^2.1.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",
    "@types/core-js": "^0.9.34",
    "@types/jasmine": "^2.5.36",
    "@types/node": "^6.0.46",
    "@types/selenium-webdriver": "^2.53.33",
    "@webcomponents/custom-elements": "1.0.0-alpha.3",
    "angular": "^1.5.8",
    "browser-sync": "^2.12.3",
    "clarity-angular": "^0.7.0",
    "clarity-icons": "^0.7.0",
    "clarity-ui": "^0.7.0",
    "codelyzer": "^1.0.0-beta.3",
    "connect-history-api-fallback": "^1.2.0",
    "core-js": "^2.4.0",
    "del": "^2.2.0",
    "gulp": "^3.9.1",
    "gulp-autoprefixer": "^3.1.0",
    "gulp-concat": "^2.6.0",
    "gulp-env": "^0.4.0",
    "gulp-inline-ng2-template": "^4.0.0",
    "gulp-preprocess": "^2.0.0",
    "gulp-sass": "^2.3.0",
    "gulp-sourcemaps": "^2.2.0",
    "gulp-tslint": "^7.0.1",
    "gulp-typescript": "^3.1.2",
    "gulp-util": "^3.0.7",
    "jasmine-core": "^2.4.1",
    "jasmine-spec-reporter": "^2.4.0",
    "karma": "^1.3.0",
    "karma-coverage": "^1.1.0",
    "karma-jasmine": "^1.0.2",
    "karma-phantomjs-launcher": "^1.0.0",
    "karma-spec-reporter": "0.0.26",
    "mutationobserver-shim": "^0.3.2",
    "phantomjs-prebuilt": "^2.1.7",
    "protractor": "^4.0.9",
    "reflect-metadata": "^0.1.8",
    "remap-istanbul": "^0.7.0",
    "run-sequence": "^1.2.1",
    "rxjs": "5.0.0-rc.4",
    "systemjs": "0.19.41",
    "systemjs-builder": "^0.15.16",
    "tslint": "^4.0.1",
    "typescript": "^2.0.3",
    "web-animations-js": "^2.2.1",
    "zone.js": "^0.7.1"
4

1 に答える 1

1

これはバージョンに関係しています。すべての角度依存関係は同じバージョンでなければなりません。あなたの場合は問題ありません。node_modulesフォルダーを削除して、npm installを実行してみてください。

これは私のファイルがどのように見え、正常に動作するかです

    "@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",
于 2016-12-12T06:36:19.740 に答える