Install Cordova plugin without package.json file on it

后端 未结 3 1291
情话喂你
情话喂你 2021-01-18 09:58

I\'m trying to install a Cordova Plugin with Cordova CLI 7.

This plugin does not have a package.json file on it, so it throws an error when adding it to my project.<

3条回答
  •  春和景丽
    2021-01-18 10:20

    Yes, since Cordova 7, the installation of platforms and plugins are by default performed using cordova-fetch which in turn uses npm install to add/remove modules. Therefore a package.json is required by default. But you should be able to add plugins lacking a package.json file by using the nofetch parameter, which forces Cordova to use the old method instead, please note that this parameter has been removed in cordova 8.0.0:

    cordova plugin add cordova-plugin-camera --nofetch

提交回复
热议问题