rodgomesc / vision-camera-code-scanner

VisionCamera Frame Processor Plugin to read barcodes using MLKit Vision QrCode Scanning
MIT License
337 stars 222 forks source link

Property '__scanQRCodes' doesn't exist #45

Open tokenswaporg opened 2 years ago

tokenswaporg commented 2 years ago

LOG Running "AwesomeProject" with {"rootTag":1} ERROR ReferenceError: Property '__scanQRCodes' doesn't exist, js engine: hermes at App (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.awesomeproject&modulesOnly=false&runModule=true:131614:41) at RCTView at View at RCTView at View at AppContainer (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.awesomeproject&modulesOnly=false&runModule=true:77063:36) at AwesomeProject(RootComponent) (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.awesomeproject&modulesOnly=false&runModule=true:83465:28) ERROR Error: Requiring module "node_modules/vision-camera-qrcode-scanner/src/index.ts", which threw an exception: ReferenceError: Property '__scanQRCodes' doesn't exist, js engine: hermes at App (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.awesomeproject&modulesOnly=false&runModule=true:131614:41) at RCTView at View at RCTView at View at AppContainer (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.awesomeproject&modulesOnly=false&runModule=true:77063:36) at AwesomeProject(RootComponent) (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.awesomeproject&modulesOnly=false&runModule=true:83465:28) ERROR TypeError: Cannot read property 'scanQRCodes' of undefined

This error is located at: in App (at renderApplication.js:50) in RCTView (at View.js:32) in View (at AppContainer.js:92) in RCTView (at View.js:32) in View (at AppContainer.js:119) in AppContainer (at renderApplication.js:43) in AwesomeProject(RootComponent) (at renderApplication.js:60), js engine: hermes ERROR TypeError: Cannot read property 'scanQRCodes' of undefined

napcoder commented 2 years ago

Did you set the babel.config.js as recommended? I had a similar issue and the problem was I missed that point.

[
  'react-native-reanimated/plugin',
  {
    globals: ['__scanCodes'],
  },
]
tokenswaporg commented 2 years ago

i did,but it didn't work... i already switch to RNCamera for now due to the lower need of camera feature for project

On Wed, Mar 9, 2022 at 6:36 PM Marco Travaglini @.***> wrote:

Did you set the babel.config.js as recommended? I had a similar issue and the problem was I missed that point.

[ 'react-native-reanimated/plugin', { globals: ['__scanCodes'], }, ]

— Reply to this email directly, view it on GitHub https://github.com/rodgomesc/vision-camera-code-scanner/issues/45#issuecomment-1062782610, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXUVEGL6PXIUO7UWHOZ2IO3U7B5MPANCNFSM5PZ25MHQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

gary-cohen commented 2 years ago

@rodgomesc I saw you fixed this issue in master but haven't pushed it to a release. Do you know when the next release will be published? Thank you. 🙏

devsonuyadav commented 2 years ago

I have setup each and every steps but its throwing error: can't find variable scanCodes . I have also configured with babel

module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: [ [ 'react-native-reanimated/plugin', { globals: ['__scanCodes'], }, ], ], };

itsam commented 2 years ago

Hello, just my 2 cents for iOS. Make sure you are using the latest version from GitHub (and not 0.1.6 from npm). That is yarn add vision-camera-code-scanner@https://github.com/rodgomesc/vision-camera-code-scanner.git currently 0.2.0

Also don't forget to pod install again to update to the latest (you will get 0.2.0 instead of 0.1.6) Hope that helps

gary-cohen commented 2 years ago

It would be nice if NPM was updated to reflect the latest version. Having developers point to master is, in my opinion, dangerous as it reduces stability in development.

itsam commented 2 years ago

It would be nice if NPM was updated to reflect the latest version. Having developers point to master is, in my opinion, dangerous as it reduces stability in development.

Couldn't agree more!

michalpetrov commented 2 years ago

I'm getting this error (Frame Processor threw an error: Can't find variable: __scanCodes) when building with Xcode beta 14.0 ... building with Xcode 13.x works fine.

esthlosx commented 2 years ago

I have the same issue (i.e. Property '__scanCodes' doesn't exist). However, I've added the needed configuration to babel.config.js. I am using Hermes JS engine.


There is a high probability that you are relying on cached parts of your js app. Try resetting the cache by running one of the following commands: npx react-native start --reset-cache or yarn start --reset-cache or npm start --reset-cache

It worked for me. Good luck.

edritech93 commented 2 years ago

same issue, I using iOS 16, MacOS 12.6 and Xcode 14

SilvanTheuma commented 2 years ago

Having same issue with Xcode 14

cccolo commented 2 years ago

hello, any news about this issue???

cemocanon commented 1 year ago

Having same issue with Xcode 14

cccolo commented 1 year ago

As an alternative I use this lib https://github.com/teslamotors/react-native-camera-kit and work fine in IOS/ANDROID

RCBiczok commented 1 year ago

Just had the same issue with the barcode scanner and Xcode 14 - Downgrade to Xcode 13.4.1 did the job for me.

DevelopCarlosWM commented 1 year ago

Have the same issue with iOS 16 and Xcode 14.0.1

Can't downgrade to Xcode 13 due it don't support iOS 16

skunchamwar1 commented 1 year ago

Any update here? I am getting the same error: ''' E/unknown:ReactNative: Exception in native call com.facebook.react.common.JavascriptException: ReferenceError: Property '__scanCodes' doesn't exist, js engine: hermes, stack: anonymous@1586:1950 h@2:1707 d@2:1150 i@2:496 anonymous@1567:619 h@2:1707 d@2:1150 i@2:496 anonymous@1490:2024 h@2:1707 d@2:1150 i@2:496 anonymous@1489:570 h@2:1707 d@2:1150 i@2:496 anonymous@1488:374 h@2:1707 d@2:1150 i@2:496 anonymous@523:637 h@2:1707 d@2:1150 i@2:496 anonymous@6:87 h@2:1707 d@2:1080 i@2:496 global@1607:3

    at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:72)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
    at com.facebook.jni.NativeRunnable.run(Native Method)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
    at java.lang.Thread.run(Thread.java:920)

E/unknown:ReactNative: Exception in native call com.facebook.react.common.JavascriptException: Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter. A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes, stack: anonymous@9:289 value@53:3310 anonymous@53:759 value@53:2583 value@53:731

    at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:72)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
    at com.facebook.jni.NativeRunnable.run(Native Method)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
    at java.lang.Thread.run(Thread.java:920)

'''

thanhdevapp commented 1 year ago

Same problem ERROR ReferenceError: Property '__scanCodes' doesn't exist, js engine: hermes

With RN 70x, Xcode lastest, Mac 11, version 0.2.0

zacdemi commented 1 year ago

This patch fixed this issue for me on Xcode14: https://github.com/rodgomesc/vision-camera-code-scanner/issues/79#issuecomment-1276041982

maiajhonathan commented 1 year ago

Same issue but on Android as well as iOS. Tried basically everything mentioned in this thread but nothing worked. Have we got a solution?

Moatezz commented 1 year ago

same issue here

Abeinevincent commented 1 year ago

I had the same issue but later on realised the problem was in babel.config.js. I was including a wrong variable scanQrCodes instead of scanCodes.

clarklight commented 1 year ago

I am still having the same issue....how do i fix it? version 0.2.0

carlgrob5171989 commented 11 months ago

"react-native-vision-camera": "2.15.6",

I am facing the same issue ( Property '__scanCodes' doesn't exist ) in Xcode 15. What is the resolution?

RCBiczok commented 11 months ago

So there can be a lot of reasons why this error happens. Most common ones are:

  1. You have cache problems and need to empty your local build chances (npm, expo, etc) and/or reinstall the apps on your test devices
  2. You are using a wrong babel config, e.g., having the wrong symbol 'scanQRCodes' vs 'scanCodes'.
  3. You have react-native-reanimated v3 or higher as peer dependency. It is known to break the 'globals' mechanism used by other packages, such as in the OCR scanner.

If the latter is the case, then try using the patch from here or just try out the built-in scanner support from Vision Camera V3

viljark commented 11 months ago

To get it to work on iOS with VisionCamera v2.16.4 and Xcode 14.3 I had to modify the FrameProcessorPlugin.h, the patch is below. I am also using a fork https://github.com/jorgebrunetto/vision-camera-code-scanner Android was working out of the box with the fork. Also I'm using "react-native-reanimated": "~3.5.4",

react-native-vision-camera+2.16.4.patch

diff --git a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h
index a545b88..ed522ae 100644
--- a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h    
+++ b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h    
@@ -53,7 +53,7 @@ objc_name : NSObject<FrameProcessorPluginBase>
 @end                                                                                \
 @implementation objc_name (FrameProcessorPlugin)                                    \
                                                                                     \
-__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)()    \
++(void)load                                                                         \
 {                                                                                   \
   [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) { \
     return [objc_name callback:frame withArgs:args];                              \

Vision Camera used to have this change, but it was changed for Xcode 15 https://github.com/mrousavy/react-native-vision-camera/commit/2ae4439c844e62131f76d35ffeca76f5a1c7237f