安装不带package.json文件的Cordova插件 [英] Install Cordova plugin without package.json file on it

查看:243
本文介绍了安装不带package.json文件的Cordova插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Cordova CLI 7安装Cordova插件.

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

此插件上没有package.json文件,因此将其添加到我的项目时会引发错误.

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

我尝试使用Plugman转换config.xml文件.而且它适用于Android,但不适用于iOS.我觉得我的package.json文件中的config.xml中缺少某些配置.

I've tried converting the config.xml file using plugman. And it works fine for Android but it doesn't for iOS. I feel like I'm missing some configuration from the config.xml in my package.json file.

有没有一种方法可以安全地将package.json文件中的config.xml转换?还是使用config.xml文件安装它的方法?

Is there a way to safely convert the config.xml in a package.json file? or a way to install it using the config.xml file?

谢谢

推荐答案

是的,自Cordova 7起,默认情况下,平台和插件的安装使用

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

这篇关于安装不带package.json文件的Cordova插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆