Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

angular - Cannot find module 'rxjs-compat/Observable'

I am currently upgrading angular 4 to angular 6 code. I have installed "rxjs": "^6.3.2" and un-installed rxjs-compact as I have migrated the code to use the new rxjs operators. I am still getting the following errors. Dont know the reason why

ERROR in [at-loader] ./node_modules/rxjs/BehaviorSubject.d.ts:1:15
    TS2307: Cannot find module 'rxjs-compat/BehaviorSubject'.

ERROR in [at-loader] ./node_modules/rxjs/Observable.d.ts:1:15
    TS2307: Cannot find module 'rxjs-compat/Observable'.

ERROR in [at-loader] ./node_modules/rxjs/Observer.d.ts:1:15
    TS2307: Cannot find module 'rxjs-compat/Observer'.

ERROR in [at-loader] ./node_modules/rxjs/Operator.d.ts:1:15
    TS2307: Cannot find module 'rxjs-compat/Operator'.

ERROR in [at-loader] ./node_modules/rxjs/Subject.d.ts:1:15
    TS2307: Cannot find module 'rxjs-compat/Subject'.

ERROR in [at-loader] ./node_modules/rxjs/Subscription.d.ts:1:15
    TS2307: Cannot find module 'rxjs-compat/Subscription'.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This will solve the issue:

npm install --save rxjs-compat 

See this GitHub issue

Edit : as per 10th October 2019 ,you can use below syntax as the earlier or the above one was a workaround.

import { Observable } from 'rxjs/Observable';

Reference doc: https://github.com/ReactiveX/rxjs/blob/master/docs_app/content/guide/v6/migration.md#dropping-the-compatibility-layer


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...