Search code examples
cordova-pluginsphonegap

Unable to install Cordova plugin barcode Phonegap (mac)


I'm super new to cordova and phonegap. I need to install the Cordova plugin barcodescanner and I have tried to do so through the Terminal (mac) with the following line:

cordova plugin add cordova-plugin-barcodescanner as specified in this document.

However, I get an error that I can not solve. I've read many other posts, and haven't found a solution for my case.

My error:

(node:1721) UnhandledPromiseRejectionWarning: CordovaError: Cannot 
find plugin.xml for plugin "cordova-plugin-barcodescanner". Please 
try adding it again.
at new PluginInfo 
(/usr/local/lib/node_modules/cordova/node_modules/cordova- 
common/src/PluginInfo/PluginInfo.js:367:15)
at PluginInfoProvider.get 
(/usr/local/lib/node_modules/cordova/node_modules/cordova- 
common/src/PluginInfo/PluginInfoProvider.js:35:32)
at /usr/local/lib/node_modules/cordova/node_modules/cordova- 
lib/src/plugman/fetch.js:177:51
at _fulfilled 
(/usr/local/lib/node_modules/cordova/node_modules/cordova- 
lib/node_modules/q/q.js:787:54)
at self.promiseDispatch.done 
(/usr/local/lib/node_modules/cordova/node_modules/cordova- 
lib/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch 
(/usr/local/lib/node_modules/cordova/node_modules/cordova- 
lib/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/cordova/node_modules/cordova- 
lib/node_modules/q/q.js:509:49
at flush (/usr/local/lib/node_modules/cordova/node_modules/cordova- 
lib/node_modules/q/q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
 (node:1721) UnhandledPromiseRejectionWarning: Unhandled promise 
 rejection. This error originated either by throwing inside of an 
 async function without a catch block, or by rejecting a promise 
 which 
 was not handled with .catch(). (rejection id: 1)
 (node:1721) [DEP0018] DeprecationWarning: Unhandled promise 
 rejections 
 are deprecated. In the future, promise rejections that are not 
 handled 
 will terminate the Node.js process with a non-zero exit code.

These are my specs: iOS: 10.13.4 Phonegap: 0.4.5

Thanks! :)


Solution

  • Ok, I figured out after many days and trials. Basically what I did was create a new project from scratch, using CLI. Then I followed step by step this documentation. When I got to the "plugin" section, I added the plugin I wanted with the following line:

    cordova plugin add cordova-plugin-barcodescanner
    

    Hope this helps other people. Cheers!