Reputation: 880
Here is the error :-
ERROR in node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'. src/app/services/data.service.ts(44,10): error TS2305: Module '"C:/Users/Rupesh/Desktop/Projects/angulartest/node_modules/rxjs/Observable"' has no exported member 'Observable'.
I have tried npm install rxjs-compat/Observable
but still getting error. Help to fix this.
Upvotes: 2
Views: 6490
Reputation: 3108
You've to fix your Rxjs imports. There are some changes in the use of rxjs from v6 onwards. so, Kindly import the observable as below
import { Observable } from 'rxjs';
instaed of import { Observable } from 'rxjs/Observable';
Upvotes: 5
Reputation: 1
Try the following import : import { Observable } from 'rxjs-compat/observable';
rxjs has known some updates with time, and some syntaxes have changed. And in many cases, we now use use 'rxjs-compat', instead of 'rxjs'.
Upvotes: 0
Reputation: 7
This is an old method.
import { Observable } from 'rxjs/Observable';
In angular 10 i have fixed this problem by using this method.
import { Observable } from 'rxjs';
Upvotes: 1
Reputation: 5
I have the same issue when I import Observable.
import { Observable } from 'rxjs/Observable';
until now, the only solution that i see is
import { Observable } from 'rxjs';
But in another question from Stack, i read that way will increase the page load (Best way to import Observable from rxjs)
Upvotes: 0
Reputation: 41407
install the whole rxjs-compact package
npm install --save rxjs-compat
Upvotes: 1