angular.js - angular2+webpack編譯錯誤
問題描述
請大家?guī)兔纯矗锪艘簧衔缌耍诰€等,先謝謝了!錯誤信息:
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:已經(jīng)找到答案,庫用錯了,應該是rxjs而不是rx。
回答2:說是rxjs/Observable沒找到,你裝了rx了么?npm install --save rxjs@5.0.0-beta.6
還有,再去掉import 'rx';試試。
最后,對照webpack+angular2搭環(huán)境看看還有哪里有區(qū)別
相關(guān)文章:
1. 如何解決Centos下Docker服務啟動無響應,且輸入docker命令無響應?2. 我在centos容器里安裝docker,也就是在容器里安裝容器,報錯了?3. 微信小程序session無法緩存的問題4. 怎么用 css3實現(xiàn)波浪底紋效果?5. vue.js - 關(guān)于Vue-cli項目在VPS中用Nginx部署完請求頁面app.js找不到提示404錯誤。6. docker 17.03 怎么配置 registry mirror ?7. html - 這種錯位的時間軸怎么布局,然后用css實現(xiàn)?8. 基于Nginx的Wordpress安裝失敗?9. css3 - 何時需要 flex-basis: 100% ?10. mysqld無法關(guān)閉
