问题描述
我想在PhoneGap项目中安装。我已经读了存储库中的Readme,它说它必须与PlugMan一起安装,如下所示:
I want to install the BarcodeScanner plugin in a PhoneGap project. I've read the Readme within the repository and it says that it must be installed with PlugMan like so:
Install a plugin
----------------
$ plugman install --platform <platform> --project <directory> --plugin <plugin> [--variable NAME=VALUE]
Parameters:
- platform <platform>: One of android, ios, blackberry10, wp7 or wp8
- project <directory>: Path reference to a cordova-generated project of the platform you specify
- plugin <plugin>: One of a path reference to a local copy of a plugin, or a remote https: or git: URL pointing to a cordova plugin (optionally append #branch:subdir) or a plugin ID from http://plugins.cordova.io
- variable NAME=VALUE: Some plugins require install-time variables to be defined. These could be things like API keys/tokens or other app-specific variables.
当我在我的项目目录中运行以下命令:
When I run the following command from within my project directory:
cordova plugin add com.phonegap.plugins.barcodescanner
我得到以下错误响应:
Fetching plugin "com.phonegap.plugins.barcodescanner" via plugin registry
Installing "com.phonegap.plugins.barcodescanner" for android
Error during processing of action! Attempting to revert...
Failed to install 'com.phonegap.plugins.barcodescanner':Error: Uh oh!
"/Users/Joel/Desktop/Sites/SampleProject/SampleProject/plugins/com.phonegap.plugins.barcodescanner/src/android/com.google.zxing.client.android.captureactivity.jar" not found!
at Object.module.exports.common.copyFile (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/common.js:20:40)
at Object.module.exports.common.copyNewFile (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/common.js:37:16)
at module.exports.source-file.install (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/android.js:42:20)
at Object.ActionStack.process (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/action-stack.js:47:25)
at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:553:20)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:303:20
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:574:44
Error: Uh oh!
"/Users/Joel/Desktop/Sites/SampleProject/SampleProject/plugins/com.phonegap.plugins.barcodescanner/src/android/com.google.zxing.client.android.captureactivity.jar" not found!
at Object.module.exports.common.copyFile (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/common.js:20:40)
at Object.module.exports.common.copyNewFile (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/common.js:37:16)
at module.exports.source-file.install (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/android.js:42:20)
at Object.ActionStack.process (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/action-stack.js:47:25)
at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:553:20)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:303:20
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:574:44
Joels-MacBook-Pro:UniSaver Joel$ cordova plugin add com.phonegap.plugins.barcodescanner
Fetching plugin "com.phonegap.plugins.barcodescanner" via plugin registry
Installing "com.phonegap.plugins.barcodescanner" for android
Error during processing of action! Attempting to revert...
Failed to install 'com.phonegap.plugins.barcodescanner':Error: Uh oh!
"/Users/Joel/Desktop/Sites/SampleProject/SampleProject/plugins/com.phonegap.plugins.barcodescanner/src/android/com.google.zxing.client.android.captureactivity.jar" not found!
at Object.module.exports.common.copyFile (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/common.js:20:40)
at Object.module.exports.common.copyNewFile (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/common.js:37:16)
at module.exports.source-file.install (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/android.js:42:20)
at Object.ActionStack.process (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/action-stack.js:47:25)
at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:553:20)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:303:20
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:574:44
Error: Uh oh!
"/Users/Joel/Desktop/Sites/SampleProject/SampleProject/plugins/com.phonegap.plugins.barcodescanner/src/android/com.google.zxing.client.android.captureactivity.jar" not found!
at Object.module.exports.common.copyFile (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/common.js:20:40)
at Object.module.exports.common.copyNewFile (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/common.js:37:16)
at module.exports.source-file.install (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/android.js:42:20)
at Object.ActionStack.process (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/action-stack.js:47:25)
at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:553:20)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:303:20
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:574:44
我做错了什么?我应该将文件复制到我的项目目录中的某个目录吗?或者在使用plugman之前应该运行其他命令吗?
What am I doing wrong? Should I be copying files to a certain directory within my project directory? Or are there any other commands I should run before using plugman?
推荐答案
不知道这里有什么问题, on 错误。
Not sure what is wrong here, but I think the plugin on http://plugins.cordova.io is wrong.
您可以尝试从git URL进行安装,但至少对我来说(在使用Cordova 3.5的窗口上)。这样做时会破坏。
You can try install from the git URL but at least for me (on windows with Cordova 3.5) something is broken when doing that.
下面的工作是什么(注意你需要安装git):
What did work was the following (note you need to have git installed):
git clone
git clone https://github.com/wildabeast/BarcodeScanner.git
Cd Cordova项目。
Cd to your Cordova project.
Cordova插件添加 InsertPath \BarcodeScanner
Cordova plugin add InsertPath\BarcodeScanner
这篇关于安装PhoneGap插件:BarcodeScanner的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!