Search code examples
cordovaphonegap-pluginscordova-pluginsphonegap

phone gap plugin in cordova project


In my project I am trying to open files which are downloaded in my phone using file opener. I my previous project i was doing the same thing using phonegap file opener module installed in my cordova project. Now I am trying to use the same module in my new project using the command cordova plugin add com.phonegap.plugins.fileopener or this command cordova plugin add cordova plugin add https://github.com/antonioJASR/FileOpener.git this is the plugin in GitHub https://github.com/markeeftb/FileOpener the errors are Error: Registry returned 404 for GET on https://registry.npmjs.org/com.phonegap.plugins.fileopener.FileOpener in the first command and Error: Cannot find plugin.xml for plugin "cordova". Please try adding it again. any idea how can i use the plugin in cordova project?


Solution

  • You are getting the first error because the plugin does not exist on the NPM repository so you can't install it like that. You are getting the second error because the plugin does not contain a package.json file and cordova tries to run npm install per default for every new plugin. You need cordovas --nofetch option to install it anyway since cordova 7.0.0:

    cordova plugin add https://github.com/antonioJASR/FileOpener.git --nofetch
    

    See the release notes for cordova 7.0.0 here to read more about the --nofetch mode.