How to keep my plugins in package.json clean?

Hi guys,

In my package.json file I have the following plugins:

...  
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-geolocation",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "com.ionic.keyboard",
    {
      "locator": "https://github.com/phonegap-build/PushPlugin.git",
      "id": "com.phonegap.plugins.PushPlugin"
    },
    {
      "locator": "https://github.com/driftyco/ionic-plugins-deploy",
      "id": "ionic-plugin-deploy"
    },
    "de.appplant.cordova.plugin.local-notification",
    "cordova-plugin-inappbrowser",
    "cordova-plugin-x-socialsharing",
    "cordova-plugin-statusbar"
  ],
  "cordovaPlatforms": [
    "ios",
    "android"
  ]

As soon as I run the command ionic state reset, it adds

"cordova-plugin-statusbar@^2.0.0",
"cordova-plugin-inappbrowser@^1.0.1"

So these plugins are defined twice, once without and once with the version. I don’t know where this is coming from. The statusbar plugin is not even the newest one (2.1.0).

When I run ionic state reset again, I get the following error:

Error executing "cordova plugin add cordova-plugin-splashscreen":
Fetching plugin "cordova-plugin-splashscreen" via npm
Installing "cordova-plugin-splashscreen" for android
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-splashscreen':Error: Uh oh!
"/Users/user/Documents/dev/app/platforms/android/src/org/apache/cordova/splashscreen/SplashScreen.java" already exists!

It’s not always the splashscreen plugin, the error varies “randomly”.

How can I clean my package.json file, that it works again with my plugins?

Thank you very much and kind regards,
Thomas

1 Like

Thanks for your answer. I managed to reset with ionic state reset multiple times without an error when I add an explicit version number to each plugin.

The strange thing is, when I add

"cordova-plugin-statusbar@^2.1.0"

it additionally adds

"cordova-plugin-statusbar@^2.0.0"

that these plugin is defined twice.


Edit: In my config.xml file a had the following line:

<plugin name="cordova-plugin-statusbar" spec="^2.1.0"/>

When changing to 2.2.0 it works as expected.

Who can explain me the difference between config.xml and package.json? :smirk:

1 Like

Any news about this. The same is happening to me, I’ve spent too much hours trying to fix it. Anyone from ionic team?