プロジェクトを Angular 2 RC 6 に更新しました。ブログ投稿http://angularjs.blogspot.com/に記載されているように、現在 Ahead of Time (AoT) Compilation を使用しようとしていますが、成功していません。
ASP.Net でプロジェクトをビルドしているので、angular cli を使用していません。
ブログ投稿が示唆するように、 @angular/compiler-cli をインストールしました
しかし、コマンド プロンプトから ngc を実行しようとすると、エラーが発生します。
'ngc' is not recognized as an internal or external command,
operable program or batch file.
npm run ngc
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ngc"
npm ERR! node v6.4.0
npm ERR! npm v3.10.3
npm ERR! missing script: ngc
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! D:\Project\App\npm-debug.log
ASP.Net プロジェクトで AoT コンパイラを使用する方法を教えてください。または、Angular CLI を使用していないが、コンポーネントなどを手動で構築している場合。
編集
最初に./node_modules/.bin/に移動してから実行することで、なんとかngcを実行できました
ngc -p D:\Project\App
しかし今、コンパイラは以下のエラーをスローしています:
プロジェクトを ngc でコンパイルしようとすると、次のエラーがスローされます。
Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 92:25 in the original .ts file), resolving symbol AppModule in
私のアプリモジュールには以下のプロバイダーがあり、おそらくこれがプロジェクトの原因です。これの何が問題なのか正確にはわかりませんか?
providers: [
GlobalService,
{
provide: Http,
useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, globalService: GlobalService) => new HttpLoading(backend, defaultOptions, globalService),
deps: [XHRBackend, RequestOptions, GlobalService]
}
],