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. 点字符“” 在MVC Web API 2中进行请求,例如api / people / STAFF.452872. 求大神指点js修改margintop导致无限下滑的问题3. javascript - node如何关闭主进程后 打开另一进程?4. php mail无法发送邮件5. mysql新建字段时 timestamp NOT NULL DEFAULT ’0000-00-00 00:00:00’ 报错6. web服务器 - ubuntu下布置apache加wsgi加python7. Mysql Begin End 语句报错8. mysql - sysbench cpu测试的结果看不懂,求解9. python3的各种库的官方文档中文版在哪儿可以找到10. python2.7为什么点击了"开始"按钮后,tkinter上的按钮,图中红色部分,再也点不动了?

网公网安备