4
votes

I am trying to install cordova plugin for camera to use in Ionic 2 application, but I am keep getting error:

Failed to install 'cordova-plugin-camera': CordovaError: Version of installed plugin: "[email protected]" does not satisfy dependency plugin requirement "cordova-plugin-compat@^1.1.0". Try --force to use installed plugin as dependency.

I tried removing cordova plugin compat and reinstalling it since I found many answers about this error on stackoverflow, but none of them worked for me. I also tried it with --force flag, but no success.

Also I tried: cordova plugin remove cordova-plugin-compat --force But I get an error:

Error: Cannot find plugin.xml for plugin "cordova-plugin-camera". Please try adding it again.

I really hope anyone can help me since I am stuck here... Thank you in beforehand.

8

8 Answers

18
votes

This might help you:

cordova plugin remove --force cordova-plugin-compat  
cordova plugin add cordova-plugin-compat  
cordova platform remove android  
cordova platform add android  
cordova plugin add cordova-plugin-camera
2
votes

Work fine for me with:

  1. ionic plugin rm --force cordova-plugin-compat
  2. ionic plugin add --force cordova-plugin-compat
  3. ionic plugin add cordova-plugin-camera

Thanks.

0
votes

I had to followed some steps:

1)Edit the file package-lock.json and delete the block from cordova-plugin-camera.
2)Enter in directory myproject/node_modules I delete the file cordova-plugin-camera
3)cordova plugin rm --force cordova-plugin-compat
4)cordova plugin add --force cordova-plugin-compat
5)cordova plugin add cordova-plugin-camera

and it worked!

0
votes

For me works this:

  1. cordova plugin remove cordova-plugin-compat --force
  2. rm -rf ./plugins/cordova-plugin-compat/
  3. cordova plugin add cordova-plugin-compat
0
votes

I noticed that the cordova-plugin-camera comes with a version of cordova-plugin-compat which has been causing a version confusion. So I did this:

ionic cordova plugin remove --force cordova-plugin-compat ionic cordova plugin add cordova-plugin-camera

No need to reinstall the cordova-plugin-compat after a successful install.

0
votes

I've tried the above, and I was finally able to install the plugin by:

  • removing the platform android
  • removing compat
  • installing new version of compat (1.1.0)
  • installing camera plugin

All the above were successfull. But I am not able anymore to properly add the platform android and run it on my device.

I've created a thread for this : Ionic 3 : Android add platform fails after installing cordova-plugin-camera

0
votes

Hi If you want to add cordova plugin into ionic v1 projecct you can do this steps

  1. Remove android
    cordova platform remove android

  2. Add Android
    cordova platform add [email protected]

  3. Remove Cordova Compat plugin
    cordova plugin remove --force cordova-plugin-compat

  4. Add Cordova compat plugin
    cordova plugin add cordova-plugin-compat

  5. Add Cordova camera plugin
    cordova plugin add cordova-plugin-camera
    or
    cordova plugin add https://github.com/apache/cordova-plugin-camera.git

I succesfully install camera plugin in ionic v1 project.

0
votes

Nothing helped me - I did this

cordova plugin add https://github.com/apache/cordova-plugin-camera.git

as described here https://github.com/apache/cordova-plugin-camera