2016-11-28 6 views
0

私はこのhttps://angular.io/docs/ts/latest/cookbook/aot-compiler.html角度2 - IBMアカデミーコンパイラ

そして、私のアプリをコンパイルするには、このコマンドを使用して、次の、角度2を学んでいます。

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

しかし、私はnode_modulesを生成しましたが、私のアプリケーションからは何も得られませんでした。 enter image description here

これは問題であるようですが、別の解決策を紹介してもらえますか?

と、ここでのTSconfig-aot.json

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "es2015", 
    "moduleResolution": "node", 
    "outDir": "./aot", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "lib": [ "es2015", "dom" ], 
    "removeComments": false, 
    "noImplicitAny": true, 
    "suppressImplicitAnyIndexErrors": true, 
    "types": [] 
    }, 

    "files": [ 
    "app/app.module.ts", 
    "app/main.ts" 
    ], 

    "angularCompilerOptions": { 
    "genDir": "./aot", 
    "skipMetadataEmit": true 
    } 
} 

//https://github.com/angular/angular/issues/11689 

とpackage.json

{ 
    "name": "angular2-quickstart", 
    "version": "1.0.0", 
    "scripts": { 
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ", 
    "lite": "lite-server", 
    "postinstall": "typings install", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "typings": "typings" 
    }, 
    "license": "ISC", 
    "dependencies": { 
    "@angular/common": "^2.2.3", 
    "@angular/compiler": "^2.2.3", 
    "@angular/compiler-cli": "^2.2.3", 
    "@angular/core": "^2.2.3", 
    "@angular/forms": "^2.2.3", 
    "@angular/http": "^2.2.3", 
    "@angular/platform-browser": "^2.2.3", 
    "@angular/platform-browser-dynamic": "^2.2.3", 
    "@angular/platform-server": "^2.2.3", 
    "@angular/router": "^3.2.3", 
    "@angular/upgrade": "^2.2.3", 
    "bootstrap": "^3.3.6", 
    "core-js": "^2.4.1", 
    "reflect-metadata": "^0.1.3", 
    "rxjs": "^5.0.0-rc.4", 
    "systemjs": "^0.19.41", 
    "typescript": "^2.0.10", 
    "typings": "^1.5.0", 
    "zone.js": "^0.6.23" 
    }, 
    "devDependencies": { 
    "concurrently": "^2.2.0", 
    "lite-server": "^2.2.2", 
    "typescript": "^2.0.2", 
    "typings": "^1.3.2" 
    } 
} 

が編集されています。私は周りの検索、誰かが助け2.0.10にタイプスクリプトをダウングレードアドバイスが、これは私には役に立たない。私は、Windows 7

答えて

1

私は角コンパイラは、基本的にはtypescriptですコンパイラをラップするのでこれに対する代替ソリューションがあります疑いを使用しています

。私は、角度v2.4.0でこれを試す機会はありませんでしたが、これは角度コンパイラのそのバージョンで修正される可能性があります。

まだv2.2.3で固まっている場合、typescriptを2.0.10にダウングレードすると機能します。あなたの例では

"devDependencies": { 
    ... 
    "typescript": "2.0.10", 
    ... 
} 

あなたはキャレットの範囲を指定したので、NPM:

"devDependencies": { 
    ... 
    "typescript": "~2.0.10", 
    ... 
} 

またはその特定のバージョンのための

、次のように:あなたのpackages.jsonではtypescriptです依存バージョンは次のように指定されていることを確認してくださいメジャーバージョン2、すなわち2.1.xを持つ最新バージョンを入手しました。 https://docs.npmjs.com/misc/semver#caret-ranges-123-025-004

+1

私の場合は2.0.2にダウングレードする必要がありました。ちょうどあなたに知らせるために。 – echonax

+0

Darylとechomaxに感謝します。Angular2 CLIを使用するように切り替えると、完璧に動作します。私はあなたの提案をまだ試みていませんが、 "キャレットレンジ"についてのあなたのコメントは本当に役に立ちます – khoailang