[ERROR] Cordova encountered an error. You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova plugin add cordova-plugin-camera --save (exit code 1):
Installing “cordova-plugin-camera” for android
Failed to install ‘cordova-plugin-camera’: CordovaError: Version of installed plugin: “cordova-plugin-compat@1.0.0” does not satisfy dependency plugin requirement “cordova-plugin-compat@^1.1.0”. Try --force to use installed plugin as dependency.
at C:\Users\shashank\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:581:33
at _fulfilled (C:\Users\shashank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\shashank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:30)
at Promise.promise.promiseDispatch (C:\Users\shashank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:749:13)
at C:\Users\shashank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:509:49
at flush (C:\Users\shashank\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
Error: Version of installed plugin: “cordova-plugin-compat@1.0.0” does not satisfy dependency plugin requirement “cordova-plugin-compat@^1.1.0”. Try --force to use installed plugin asPreformatted text dependency.
Try the first line but leave out Cordova. Ionic plugin add…etc…, Second command should/could be ionic plugin --save Cordova-plugin-camera. You may have to add the plugin to your json.manifest and/or config.xml. Can’t recall right now. This is how I worked around the same issue.
Basically, if you look at ionic’s component docs for adding the camera plugin but leave Cordova out of the 1st command, it should work.
The error message looks pretty self-explanatory to me. You have a version of cordova-plugin-compat installed that is too old to be compatible with the camera plugin you are trying to install, so you must update it to at least 1.1.0.
Yeah, I have version 2.4.1 in an ionic 2 project. Might be time to upgrade. Though, the ionic-Cordova-plugin syntax returned error messages in ionic 2 as well. Not sure if there’s a difference between how 2 and 3 interpret or process that line. I will say, the ionic team has responded to a lot of questions with a reminder that 3 is in beta, and to except quirks and changes.
Sorry, but I have no idea what you are trying to say here. I am saying that the error message you posted suggests that you need to upgrade cordova-plugin-compat. This has absolutely nothing whatsoever to do with the Ionic CLI version. Furthermore, the v3 CLI is no longer in beta. It has been released.
If you want to add cordova plugin into ionic v1 project you can do this steps
1>Remove android
cordova platform remove android
2>Add Android
Cordova platform add android@5.0.0