git Ionic/Cordova:如何将插件安装到现有项目中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23671826/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ionic/Cordova: How to install plugin into existing project?
提问by BadmintonCat
How do I install an additional Cordova plugin into an existing Ionic/Cordova project? I need the Cordova Camera Plugin. If I try:
如何在现有的 Ionic/Cordova 项目中安装额外的 Cordova 插件?我需要 Cordova 相机插件。如果我尝试:
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.
回答by Taban Cosmos
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.
你在做正确的事情,但最后你有camera.git。那就是问题所在。这是正确的做法!它对我有用。
$ cordova plugin add org.apache.cordova.camera
回答by zatamine
The best way to install cordova plugin in ionic by tapping these commands line :
通过点击以下命令行在 ionic 中安装cordova插件的最佳方法:
$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/
并按照官方文档https://ionicframework.com/docs/native/camera/上的说明进行操作
Good luck :)
祝你好运 :)