How to remove installed ionic cordova plugin from

2019-04-06 18:16发布

问题:

I installed Cordova and Ionic Native plugins into the ionic3 project.

But I need to remove only that specific Cordova and Ionic Native plugins from the project completely. (With its dependencies like npm).

Is there any proper way to do that?

Appreciate any kind of your help.

Thank you!

回答1:

I just refer their document here.

Example:

To install a plugin we are using following way.

ionic cordova plugin add <plugin-name>

(ionic cordova plugin add cordova-plugin-dialogs)

npm install --save @ionic-native/<npm-name-of-plugin>

(npm install --save @ionic-native/dialogs)

To Uninstall the plugin just need to revert above things back as bellow

ionic cordova plugin remove <plugin-name> or ionic cordova plugin rm <plugin-name>

(ionic cordova plugin remove cordova-plugin-dialogs) or (ionic cordova plugin rm cordova-plugin-dialogs)

Finally uninstall the associated Ionic Native package(s) from npm

npm uninstall --save @ionic-native/<npm-name-of-plugin>

(npm uninstall --save @ionic-native/dialogs)

The --save flag will remove the project's package.json entry for that plugin

Doing above things helps me to remove plugin completely with its npm dependencies from the project. Hope this will useful to someone else



回答2:

please make sure that you also run npm uninstall after ionic cordova remove skipping this may lead to serious consequences like for instance the BUILD is successful but some of features in the App fails in the runtime complaining the plugin is missing, what must have happened in this case is re installation must have silently failed as the plugin source still exists due to not performing npm uninstall, such mistakes do happen while migrations, upgrade to new CLI. In my case InAppPurchase2 plugin did not work, payments stopped working :(, something quite miserable isn't it..hope the lesson helps someone out there..



回答3:

You can use the following command to remove

ionic cordova plugin rm <plugin name>

Example :

ionic cordova plugin rm cordova-plugin-camera

Please check the similar type of question to here.

Also please check the documentation of plugin commands from here.

Hope this will help you!!



回答4:

Try below

ionic cordova plugin remove <PLUGIN_NAME> --no-interactive

READ MORE

Hope this helps