Removing cordova plugins from the project

前端 未结 14 1977
情书的邮戳
情书的邮戳 2020-12-12 15:50

Somehow in my app many of the cordova plugins are installed and because of that it requires access to almost everything - from my contacts to current location ( even though

相关标签:
14条回答
  • 2020-12-12 16:36
    • access the folder
    • list the plugins (cordova plugin list)
    • ionic cordova plugin remove "pluginName"

    Should be fine!

    0 讨论(0)
  • 2020-12-12 16:38

    I do it with this python one-liner:

    python -c "import subprocess as sp;[sp.call('cordova plugin rm ' + p.split()[0], shell=True) for p in sp.check_output('cordova plugin', shell=True).split('\n') if p]"
    

    Obviously it doesn't handle any sort of error conditions, but it gets the job done.

    0 讨论(0)
  • 2020-12-12 16:39

    If the above solution didn't work and you got any unhandled promise rejection then try to follow steps :

    1. Clean the Cordova project

      cordova clean

      1. Remove platform

    cordova platform remove android/ios

    1. Then remove plugin

    cordova plugin remove

    1. add platforms and run the project It worked for me.
    0 讨论(0)
  • 2020-12-12 16:40

    This is somewhat related and might help others, I had a corrupt version of some of my plugins so I was able to just delete the entire contents of the plugins folder. Note, all references are still in the package.json and config.xml files to the plugins. So then when I removed and added the Android platform, it re-installed the uncorrupted versions of the plugins and fixed my problem.

    0 讨论(0)
  • 2020-12-12 16:45

    v2.0.0 of cordova-check-plugins enables you to remove all plugins in a project:

    $ npm install -g cordova-check-plugins
    $ cordova-check-plugins --remove-all
    

    It will attempt to use the Cordova CLI to remove each plugin, but if this fails it will force removal of the plugin from platforms/ and plugins/.

    If you also want to remove from config.xml, use:

    $ cordova-check-plugins --remove-all --save
    

    Disclaimer: I am the author of cordova-check-plugins

    0 讨论(0)
  • 2020-12-12 16:45

    When running the command: cordova plugin remove <PLUGIN NAME>, ensure that you do not add the version number to the plugin name. Just plain plugin name, for example:

    cordova plugin remove cordova.plugin_name 
    

    and not:

    cordova plugin remove cordova.plugin_name 0.01 
    

    or

    cordova plugin remove "cordova.plugin_name 0.01"
    

    In case there is a privilege issue, run with sudo if you are on a *nix system, for example:

    sudo cordova plugin remove cordova.plugin_name
    

    Then you may add --save to remove it from the config.xml file. For example:

    cordova plugin remove cordova.plugin_name --save
    
    0 讨论(0)
提交回复
热议问题