Add cordova-plugin-screen-orientation plugin to my ionic 7 app

I receve dependency error during plugin install:

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

The error is:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: partogramma@0.0.1
npm ERR! Found: rxjs@7.5.7
npm ERR! node_modules/rxjs
npm ERR!   rxjs@"~7.5.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs@"^5.5.0 || ^6.5.0" from @ionic-native/core@5.36.0
npm ERR! node_modules/@ionic-native/core
npm ERR!   peer @ionic-native/core@"^5.1.0" from @ionic-native/screen-orientation@5.36.0
npm ERR!   node_modules/@ionic-native/screen-orientation
npm ERR!     @ionic-native/screen-orientation@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!

How can I solve it?

Use @awesome-cordova-plugins/screen-orientation instead of @ionic-native/screen-orientation

1 Like