Phonegap-plugin-barcodescanner error

I had a plugin working and it opened up my camera as a scanner but for some reason tried to build an app again and at first, the scanner didn’t work so I uninstalled and downgraded to android 6.4.0 and Android 6.3.0 and installed the plugin again. Now the build fails when doing ionic cordova run android --device. Any ideas why this is as was working previously. I can add the QR scanner code but I don’t think this is the problem as it was working previously. Below is error got from trying build app

BUILD FAILED in 12s
at ChildProcess.whenDone (/home/declan/DUP/test/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at ChildProcess.emit (events.js:127:13)
at maybeClose (internal/child_process.js:933:16)
at Process.ChildProcess._handle.onexit
(internal/child_process.js:220:5)
(node:12313) 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:12313) [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.