Nav*_*med 6 angular2-services angular2-compiler angular
我刚刚将我的项目更新为Angular 2 RC 6.我现在正在尝试使用Ahead of Time(AoT)编译,如博客文章http://angularjs.blogspot.com/中所述,但没有成功.
我在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
Run Code Online (Sandbox Code Playgroud)
任何人都可以指导如何使用ASP.Net项目的AoT编译器.或者,当您不使用Angular CLI但手动构建组件等时.
编辑
我现在设法运行ngc,首先移动到./node_modules/.bin/然后运行
ngc -p D:\Project\App
Run Code Online (Sandbox Code Playgroud)
但是现在编译器抛出了以下错误:
当我尝试使用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
Run Code Online (Sandbox Code Playgroud)
在我的应用程序模块中,我有以下提供程序,可能这是导致该项目.我不确定这究竟是什么问题?
providers: [
GlobalService,
{
provide: Http,
useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, globalService: GlobalService) => new HttpLoading(backend, defaultOptions, globalService),
deps: [XHRBackend, RequestOptions, GlobalService]
}
],
Run Code Online (Sandbox Code Playgroud)
GlobalService,
{
provider: Http, // <-- I believe you were missing the "r" in provide"r"
}
Run Code Online (Sandbox Code Playgroud)
看一下 rc6 的重大变化:
https://github.com/angular/angular/blob/master/CHANGELOG.md#writing-changes
| 归档时间: |
|
| 查看次数: |
4422 次 |
| 最近记录: |