Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove cordova-plugin-compat?

In the release notes of cordova-android 6.3.0 (https://cordova.apache.org/announcements/2017/09/27/android-release.html) it's written down that cordova-plugin-compat has to be removed

If I try

cordova plugin rm cordova-plugin-compat

I get following error

[ERROR] An error occurred while running cordova plugin remove cordova-plugin-compat --save (exit code 1):

Error: The plugin ‘cordova-plugin-compat’ is required by (cordova-plugin-calendar, cordova-plugin-camera, cordova-plugin-file, cordova-plugin-geolocation), skipping uninstallation. (try --force if trying to update)

If I then try to --force the remove, it works, the plugin is removed and I'm able to build my android app.

BUT, I just removed my iOS platform to add it again and I face now the error

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

[ERROR] An error occurred while running cordova prepare ios (exit code 1).

Any idea what am I doing wrong? Should really cordova-plugin-compat be removed? Why my iOS platform is referencing it, I thought it was only for android?

I use [email protected] and [email protected]

P.S.: If I remove and add the iOS platform, the compat plugin is automatically added as reference in package.json and package-lock.json

UPDATE

The last plugin release (https://cordova.apache.org/news/2017/11/10/plugins-release.html) most probably solve this issue respectively it looks like that the problem was the reference to the cordova-plugin-compat plugin from other plugin. But,

I'm not yet able to totally test it and solve it because I'm using another plugin where compat is also referenced (https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin/issues/426).

I will keep this thread open till I could 100% confirm that this solve the referencing of compat.

FINAL UPDATE

The PR to remove the dependency from Calendar-PhoneGap-Plugin to ‘cordova-plugin-compat’ went thru, I was able to remove this last plugin without "force"

like image 428
David Dal Busco Avatar asked Oct 03 '17 18:10

David Dal Busco


People also ask

How do I remove a Cordova plugin?

It is not possible to remove plugins or platforms in this manner. The recommended method of adding and removing plugins and platforms is with the command line cordova commands cordova plugin add|remove ... and cordova platform add|remove ... to avoid any out of sync issues.

What is Cordova plugin file?

This plugin implements a File API allowing read/write access to files residing on the device. This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/

What are different plugins in Cordova?

A Cordova platform: "cordova-android" , "cordova-ios" , "cordova-windows" , etc. Another Cordova plugin: "cordova-plugin-camera" , etc.

How do I update Cordova to latest version?

Update Cordova CLI, cordova Then compare the returned version number to the output of npm info cordova version (You can also check manually for the newest available version on npm or GitHub). Run cordova -v again after the update to make sure the update worked and it now returns the current version.


2 Answers

The source of the problem was that plugins were directly referencing cordova-plugin-compat.

Therefore, even if the use of the plugin was deprecated, it was still needed. Forcing a deletion (using --force) wasn't a solution, because if I removed and added a platform again, then, because of these references, the plugin ‘cordova-plugin-compat’ was automatically added again during that process.

The solution of the problem was then to wait for new releases or to submit PR to remove the dependency.

In my case there were the plugins which were referencing cordova-plugin-compat:

Error: The plugin ‘cordova-plugin-compat’ is required by (cordova-plugin-calendar, cordova-plugin-camera, cordova-plugin-file, cordova-plugin-geolocation), skipping uninstallation. (try --force if trying to update)

Updating following plugins solved my issue:

[email protected], [email protected] and [email protected] removed the dependency (see https://cordova.apache.org/news/2017/11/10/plugins-release.html)

[email protected] removed the dependency thru this PR https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin/pull/430

like image 73
David Dal Busco Avatar answered Nov 15 '22 11:11

David Dal Busco


For me what fixed it was updating the Android SDK via Android Studio, then running:

cordova plugin rm cordova-plugin-compat --force
cordova platform rm android
cordova platform add [email protected]

Hope that helps someone!

like image 40
Uniphonic Avatar answered Nov 15 '22 11:11

Uniphonic