0

I'm using angular 8 and when I'm running the code these errors are appear. how to solve this ?

why these error are appear? Can anyone explain this?

** ERROR in Debug Failure. False expression.

ERROR in node_modules/rxjs/Subject.d.ts:1:15 - error TS2307: Cannot find module 'rxjs-compat/Subject' or its corresponding type declarations.

1 export * from 'rxjs-compat/Subject';
                ~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/material/core/typings/common-behaviors/error-state.d.ts:11:10 - error TS2305: Module '"../../../../../rxjs/Subject"' has no exported member 'Subject'.

11 import { Subject } from 'rxjs/Subject';
            ~~~~~~~
node_modules/rxjs/Observable.d.ts:1:15 - error TS2307: Cannot find module 'rxjs-compat/Observable' or its corresponding type declarations.

1 export * from 'rxjs-compat/Observable';
                ~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/material/core/typings/common-behaviors/initialized.d.ts:9:10 - error TS2305: Module '"../../../../../rxjs/Observable"' has no exported member 'Observable'.

9 import { Observable } from 'rxjs/Observable';
           ~~~~~~~~~~
node_modules/@angular/material/core/typings/datetime/date-adapter.d.ts:9:10 - error TS2305: Module '"../../../../../rxjs/Observable"' has no exported member 'Observable'.

9 import { Observable } from 'rxjs/Observable';
           ~~~~~~~~~~
node_modules/@angular/material/core/typings/datetime/date-adapter.d.ts:10:10 - error TS2305: Module '"../../../../../rxjs/Subject"' has no exported member 'Subject'.

10 import { Subject } from 'rxjs/Subject';
            ~~~~~~~
node_modules/@angular/material/core/typings/option/option.d.ts:1:10 - error TS2305: Module '"../../../../../rxjs/Subject"' has no exported member 'Subject'.

1 import { Subject } from 'rxjs/Subject';
           ~~~~~~~
node_modules/@angular/material/form-field/typings/form-field-control.d.ts:8:10 - error TS2305: Module '"../../../../rxjs/Observable"' has no exported member 'Observable'.

8 import { Observable } from 'rxjs/Observable';
           ~~~~~~~~~~
node_modules/@angular/material/input/typings/input.d.ts:6:10 - error TS2305: Module '"../../../../rxjs/Subject"' has no exported member 'Subject'.

6 import { Subject } from 'rxjs/Subject';
           ~~~~~~~
node_modules/@angular/material/select/typings/select.d.ts:16:10 - error TS2305: Module '"../../../../rxjs/Observable"' has no exported member 'Observable'.   

16 import { Observable } from 'rxjs/Observable';
            ~~~~~~~~~~
RANA 04
  • 48
  • 7
  • Does this answer your question? [Cannot find module 'rxjs-compat/Observable'](https://stackoverflow.com/questions/52388927/cannot-find-module-rxjs-compat-observable) – Harun Yilmaz Oct 05 '20 at 08:52
  • yes I tried but not working . is this issue related to version?? – RANA 04 Oct 05 '20 at 11:05
  • `rxjs-compat` is used as a workaround for migration from v5 to newer. I think you should consider refactoring your code to use `rxjs` instead of `rxjs-compat`. This [article](https://medium.com/@cartant/rxjs-avoiding-rxjs-compat-4b79a566359b) might help – Harun Yilmaz Oct 05 '20 at 11:52

3 Answers3

1

It is due to mismatching of the version you downloaded and the angular version. You have to choose whether it is suitable or not to the angular version you use..

Gem
  • 513
  • 2
  • 6
  • 17
0

Try this

npm install rxjs-compat --save
IRSHAD
  • 1,582
  • 11
  • 16
0

You need to import classes from rxjs like so:

import { Observable, Subject } from "rxjs";

Why? rxjs changed their export layout to use a single export file instead of using paths to specify dependency locations.