Failed to install 'cordova-plugin-x-socialsharing' - Cannot find module 'compare-func'

Failed when I try to install the plugin cordova-plugin-x-socialsharing.
I already removed and installed again the cordova and continue the same problem.
npm uninstall cordova -g / npm install cordova -g

Ionic info
Ionic:

Ionic CLI : 5.4.16
Ionic Framework : @ionic/angular 5.5.0
@angular-devkit/build-angular : 0.1002.0
@angular-devkit/schematics : 10.1.7
@angular/cli : 10.2.0
@ionic/angular-toolkit : 2.3.3

Cordova:

Cordova CLI : 10.0.0
Cordova Platforms : not available
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 8 other plugins)

Utility:

cordova-res : 0.15.2
native-run : 1.2.2

System:

NodeJS : v14.15.0 (C:\Program Files\nodejs\node.exe)
npm : 6.14.8
OS : Windows 10

The problem

cordova.cmd plugin add cordova-plugin-x-socialsharing
Installing “cordova-plugin-x-socialsharing” for android
Plugin dependency “es6-promise-plugin@4.2.2” already fetched, using that version.
Dependent plugin “es6-promise-plugin” already installed on android.
Failed to install ‘cordova-plugin-x-socialsharing’: CordovaError: Failed to instantiate ProjectBuilder builder: Error: Cannot find module ‘compare-func’

You can try install compare-func, npm install compare-func

Or global npm install -g compare-func

Thanks for your reply… Installed the compare-func, but still with the same problem
npm install -g compare-func

  • compare-func@2.0.0
    added 4 packages from 2 contributors in 0.588s

cordova.cmd plugin add cordova-plugin-x-socialsharing
Installing “cordova-plugin-x-socialsharing” for android
Plugin dependency “es6-promise-plugin@4.2.2” already fetched, using that version.
Dependent plugin “es6-promise-plugin” already installed on android.
Failed to install ‘cordova-plugin-x-socialsharing’: CordovaError: Failed to instantiate ProjectBuilder builder: Error: Cannot find module ‘compare-func’

try install in the your project, npm install compare-func

Thanks again my friend… this time installed, but in the end returned a fail.

cordova.cmd plugin add cordova-plugin-x-socialsharing
Installing “cordova-plugin-x-socialsharing” for android
Plugin dependency “es6-promise-plugin@4.2.2” already fetched, using that version.
Dependent plugin “es6-promise-plugin” already installed on android.
Subproject Path: CordovaLib
Subproject Path: app
Subproject Path: com.google.playservices/starter-google-play-services_lib
Installing “cordova-plugin-x-socialsharing” for browser
6.0.0
Plugin dependency “es6-promise-plugin@4.2.2” already fetched, using that version.
Installing “es6-promise-plugin” for browser
6.0.0
Installing “cordova-plugin-x-socialsharing” for ios
Plugin dependency “es6-promise-plugin@4.2.2” already fetched, using that version.
Installing “es6-promise-plugin” for ios
Adding cordova-plugin-x-socialsharing to package.json
The product name change ( tag) in config.xml is not supported dynamically.
To change your product name, you have to remove, then add your ios platform again.
Make sure you save your plugins beforehand using cordova plugin save.
cordova plugin save
cordova platform rm ios
cordova platform add ios

[ERROR] An error occurred while running subprocess cordova.

    cordova.cmd plugin add cordova-plugin-x-socialsharing exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

just install npm i es6-promise-plugin

refer this link