flyingzl/angular2-seed

呃,跑不起来

occultskyrong opened this issue · 11 comments

下载了你这个工程,把三个命令跑了一下,node是4.2.1的.

跑不起来啊。。直接卡在Loading...
然后console里面报错

TypeError: m.values is not a function
at createArrayFromMap (http://localhost:9000/libs/angular2.dev.js:4050:43)
at Function.MapWrapper.values (http://localhost:9000/libs/angular2.dev.js:4096:14)
at _createListOfProviders (http://localhost:9000/libs/angular2.dev.js:20008:36)
at Object.resolveProviders (http://localhost:9000/libs/angular2.dev.js:19987:22)
at Function.Injector.resolve (http://localhost:9000/libs/angular2.dev.js:22639:25)
at Function.Injector.resolveAndCreate (http://localhost:9000/libs/angular2.dev.js:22642:40)
at Object.platformCommon (http://localhost:9000/libs/angular2.dev.js:19477:48)
at platform (http://localhost:9000/libs/angular2.dev.js:26634:30)
at Object.commonBootstrap (http://localhost:9000/libs/angular2.dev.js:26645:13)
at Object.bootstrap (http://localhost:9000/libs/angular2.dev.js:27475:33)

后来找到原因了,大概是chromev43不支持es6.

所以。。。建议你把es6往es5跳的js也加上。

貌似是angular2.dev.js的问题,低版本的浏览器上估计得上一个es6-shim和es5-shim

src\app.ts(6,8): error TS2307: Cannot find module 'angular2/angular2'.
src\form.ts(10,10): error TS2307: Cannot find module 'angular2/angular2'.
src\router.ts(1,46): error TS2307: Cannot find module 'angular2/angular2'.
src\router.ts(11,8): error TS2307: Cannot find module 'angular2/router'.
src\services\Validators.ts(1,38): error TS2307: Cannot find module 'angular2/ang
ular2'.

我按照步骤安装了各种包,然后gulp play启动APP,报了如上的错误

@wubin1989 控制台报错倒是不用太在意,那个是typings找不到。我发现angular2 beta.0 把angular2的typings去掉了。页面不报错就可以。

angular2 能用TOMCAT跑吗?还是一定要用 npm start ?

我也遇到这个问题了 gulp编译到dist目录的时候缺少/Rx.js 和好多js文件,是不是gulpfile.js 有点问题

http://localhost:9000/libs/Rx.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9000/rxjs/Subject Failed to load resource: the server responded with a status of 404 (Not Found)
angular2-polyfills.js:138 Error: XHR error (404 Not Found) loading http://localhost:9000/rxjs/Subject(…)run @ angular2-polyfills.js:138
http://localhost:9000/rxjs/observable/fromPromise Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9000/rxjs/operator/toPromise Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9000/rxjs/Observable Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9000/rxjs/Subject Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9000/rxjs/observable/fromPromise Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9000/rxjs/operator/toPromise Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9000/rxjs/Observable Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9000/favicon.ico Failed to load resource: the server responded with a status of 404 (Not Found)

我之前用的时候还是可以的 很长时间没弄这个angular了,我转react了

@georgezouq 现在已经不用gulp了,转换为webpack了,你再试试看?

@stewchicken 可以用tomcat跑,前提是把angular2的代码编译为es6,然后用jsp引入对应的脚本即可。之所以用npm是为了方便快速测试

@hainuo 因为angular2迭代速度太慢了,一直没法用到产品中。而React已经有相当规模的生态区了。其实我们开发中用的都是React了。

终于关了。。。。。

我现在开发用的Browserify file watcher。。。
然后测试和生产是用webpack,因为webpack的watcher延时太坑,得等或者手动。。。。
webstorm可以写Browserify的file watcher。。。。没试过写webpack的file watcher。。。