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. angular.js - angularJS路由学习的问题2. mySql排序,序号3. 关于设计mysql中一个字段自增的函数。4. docker - 如何修改运行中容器的配置5. angular.js使用$resource服务把数据存入mongodb的问题。6. docker start -a dockername 老是卡住,什么情况?7. docker容器呢SSH为什么连不通呢?8. css - ionic中的栅格布局如何让文字内容多少不同的每一列中的内容都能垂直居中?9. dockerfile - 我用docker build的时候出现下边问题 麻烦帮我看一下10. css3 - 为什么css里面要带-moz-|-webkit-后又来一个不带它们的
