Search code examples
npmphonegap

A dummies guide to installing a PhoneGap plugin


I am trying to build a basic QR code scanning app but I am not exactly sure how to add a plugin. I am trying to install - https://www.npmjs.com/package/cordova-plugin-barcodescanner

I have installed NPM, GIT and Cordova, and have deployed a Framework 7 based app from the phonegap software that has the following directory:

C:\Users\user\Documents\Phonegap Apps\Saving Energy\Android

enter image description here

I am unsure how to install the plugin? Do I run

npm i cordova-plugin-barcodescanner 

in Windows Command Prompt, and if so do I have to change the directory to my app plugin folder? Do I run it using node.js? Etc.


Solution

  • You can add plugin easily using cordova

    you should open command prompt with Saving Energy as directory and run

    cordova plugin add [cordova-plugin-name]
    

    For your case it is

    cordova plugin add cordova-plugin-barcodescanner
    

    Hope it Helps!