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. 在windows下安装docker Toolbox 启动Docker Quickstart Terminal 失败!2. 如何解决docker宿主机无法访问容器中的服务?3. angular.js - angularjs scope.$watch取不到input变化的值4. mysql - 仅仅只是把单引号与反斜杠转义不用prepare statement能否避免sql注入?5. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?6. dockerfile - [docker build image失败- npm install]7. docker api 开发的端口怎么获取?8. javascript - Android 的 webview 中怎么监听 url 的 hash 变化9. java - 为什么第一个线程已经释放了锁,第二个线程却不行?10. html5 - bootstrap修改样式的问题

网公网安备