Ionic/Cordova: How to install plugin into existing project?

拟墨画扇 提交于 2019-12-24 04:05:04

问题


How do I install an additional Cordova plugin into an existing Ionic/Cordova project? I need the Cordova Camera Plugin. If I try:

cordova plugin add https://github.com/apache/cordova-plugin-camera.git

I get error:

Error: Command failed: fatal: could not create work tree dir .... No such file or directory.

回答1:


You are doing the right thing but you have camera.git at the end. That is the problem. This is correct way of doing it! It worked for me.

$ cordova plugin add org.apache.cordova.camera



回答2:


The best way to install cordova plugin in ionic by tapping these commands line :

$ionic cordova plugin add cordova-plugin-camera
$npm install --save @ionic-native/camera

Add the plugin in your module app here

And follow the instruction on the official documentation https://ionicframework.com/docs/native/camera/

Good luck :)



来源:https://stackoverflow.com/questions/23671826/ionic-cordova-how-to-install-plugin-into-existing-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!