Cp Karthik
Cp Karthik

Reputation: 23

How to fix Cannot find module 'rxjs-compat/Observable' error?

I am creating an ionic app with Ionic 4 based on angular 6! To set the screen orientation installed the below plugin.

ionic cordova plugin add cordova-plugin-screen-orientation
npm install --save @ionic-native/screen-orientation

And imported in required typescript! But when i run the project i got the error below.

ERROR in node_modules/@ionic-native/screen-orientation/index.d.ts(2,10): error TS2305: Module '"/Users/karthikcp/Documents/IONIC/myBake/node_modules/rxjs/Observable"' has no exported member 'Observable'.
[ng] node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.

Can anyone help me in fixing this error?

Upvotes: 2

Views: 3503

Answers (2)

Yogesh Kumar
Yogesh Kumar

Reputation: 1046

npm i rxjs-compat

Please add these command on your root folder

Upvotes: 0

Joel
Joel

Reputation: 1064

In Ionic 4 you need to install all your native plugins as beta:

npm install --save @ionic-native/screen-orientation@beta

Inside your code, for Angular, the import path should end with /ngx.

import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';

Don't install rxjs-compact.

Upvotes: 3

Related Questions