bitpay / cordova-plugin-qrscanner

A fast, energy efficient, highly-configurable QR code scanner for Cordova apps and the browser.
MIT License
568 stars 772 forks source link

Install fails with Error: Cannot find module '../cordova/platform_metadata' #144

Closed jmargolese closed 6 years ago

jmargolese commented 6 years ago

Installing on Ionic results in a failure with:

Saved plugin info for "cordova-plugin-qrscanner" to config.xml

(node:2518) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module '../cordova/platform_metadata'

There were similar errors with cordova-plugin-ios etc that are supposed to have been fixed and may show the error.

Workaround is to downgrade from Cordova 8 to cordova 7.1.0
npm uninstall -g cordova npm install -g cordova@7.1.0

and then installed with cordova... not ionic cordova.

My env when I first encountered the error:

ionic info

cli packages: (/Users/joelm/.nvm/versions/node/v8.4.0/lib/node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 7.0.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.0.2
ios-deploy        : 1.9.2
ios-sim           : 6.1.2
Node              : v8.4.0
npm               : 5.6.0
OS                : macOS High Sierra
Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

ANDROID_HOME : /Users/joelm/Library/Android/SDK

Misc:

backend : pro
peratik commented 6 years ago

same issue please help

adilhaddaoui commented 6 years ago

Same issue here !!

iCodr8 commented 6 years ago

Same Problem :(

EnggZahidulislam commented 6 years ago

Step 1: delete all folder except src and resources Step 2: run command npm install Step 3: run command ionic serve Step 4: run command ionic cordova build android this process solved my issue

iCodr8 commented 6 years ago

I couldn't fix it and now I'm using the Barcode Scanner. This plugin can also scan QR codes.

MarcelOerlemans commented 6 years ago

I have the same error, and I do not use ionic. Command: phonegap plugin add cordova-plugin-qrscanner Error: (node:14296) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module '../cordova/platform_metadata'

Is there a fix or workaround available? ps.: EnggZahidulislam's solution did not work for me

phonegap info Node version: v8.9.2 Cordova version: 8.0.0

yunderboy commented 6 years ago

I've been encountering that same issue...

pverdu commented 6 years ago

I have the same issue aswel. If someone knows a fix...

MarcelOerlemans commented 6 years ago

My solution: use phonegap-plugin-barcodescanner. Although I understand that might not be possible for everyone.

pverdu commented 6 years ago

My solution: use phonegap-plugin-barcodescanner. Although I understand that might not be possible for everyone.

I wanted to try this plugin, since the phonegap-plugin-barcodescanner plugin is a bit slow in opening the scanner.

MarcelOerlemans commented 6 years ago

Yes, the phonegap scanner is definately a bit slower. But what can one do :(

pverdu commented 6 years ago

Yeah indeed. I had implemented Scandit which is superior over all scanners, but it's way to expensive also.

matiu commented 6 years ago

As a workaround, you can downgrade to cordova 7: npm uninstall -g cordova && npm install -g cordova@7.1.0

Story5 commented 6 years ago

I have the same issue

wasinr commented 6 years ago

try this

This was a bug in cordova-plugin-add-swift-support, just update it to latest version (1.7.1)

cordova plugin rm cordova-plugin-add-swift-support --force cordova plugin add cordova-plugin-add-swift-support

credit : https://stackoverflow.com/questions/48087357/cordova-8-ios-4-5-4-cannot-find-module-cordova-platform-metadata

bitjson commented 6 years ago

Fixed in 2.6.0 🚀