angular.js - angular2+webpack编译错误
问题描述
请大家帮忙看看,憋了一上午了,在线等,先谢谢了!错误信息:
ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts(8,28): error TS2307: Cannot find module ’rxjs/Observable’.ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts(9,25): error TS2307: Cannot find module ’rxjs/Subject’.ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts(10,28): error TS2307: Cannot find module ’rxjs/Observable’.ERROR in /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/@angular/core/src/facade/async.d.ts(11,25): error TS2307: Cannot find module ’rxjs/Subject’.
tsconfig.json
{ 'compilerOptions': {'target': 'es5','module': 'commonjs','moduleResolution': 'node','sourceMap': true,'experimentalDecorators': true }, 'buildOnSave': false, 'compileOnSave': false, 'exclude': ['node_modules' ]}
index.ts
import 'es6-shim';import 'rx';import {Component} from ’@angular/core’;
问题解答
回答1:已经找到答案,库用错了,应该是rxjs而不是rx。
回答2:说是rxjs/Observable没找到,你装了rx了么?npm install --save rxjs@5.0.0-beta.6
还有,再去掉import 'rx';试试。
最后,对照webpack+angular2搭环境看看还有哪里有区别
相关文章:
1. web - nginx location 搜索算法问题!?2. windows-7 - win7下使用cmder,如何设置vim的tab为4个空格?3. thinkPHP5中获取数据库数据后默认选中下拉框的值,传递到后台消失不见。有图有代码,希望有人帮忙4. python - 怎么进行服务器性能分析5. javascript - 关于js高级程序中的问题6. python 多进程 或者 多线程下如何高效的同步数据?7. mysql - 要取出数据库中按某字段排序后的前10,20,30条数据要怎么做?8. MySQL的SELECT...FOR UPDATE究竟起什么作用9. javascript - nodejs使用mongoose连接数据库,使用post提交表单在后台,后台处理后调用res.redirect()跳转界面无效?10. media-query - 请教为何CSS3媒体查询语法不能生效?

网公网安备