vision-camera-code-scanner icon indicating copy to clipboard operation
vision-camera-code-scanner copied to clipboard

Property '__scanQRCodes' doesn't exist

Open tokenswaporg opened this issue 3 years ago • 26 comments
trafficstars

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

tokenswaporg avatar Mar 03 '22 09:03 tokenswaporg

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'],
  },
]

napcoder avatar Mar 09 '22 10:03 napcoder

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: @.***>

tokenswaporg avatar Mar 10 '22 01:03 tokenswaporg

@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. 🙏

gary-cohen avatar Mar 20 '22 16:03 gary-cohen

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'], }, ], ], };

devsonuyadav avatar Mar 29 '22 18:03 devsonuyadav

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

itsam avatar Mar 31 '22 12:03 itsam

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.

gary-cohen avatar Apr 01 '22 07:04 gary-cohen

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!

itsam avatar Apr 01 '22 08:04 itsam

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.

michalpetrov avatar Jun 07 '22 12:06 michalpetrov

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.

esthlosx avatar Jun 21 '22 08:06 esthlosx

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

edritech93 avatar Sep 26 '22 03:09 edritech93

Having same issue with Xcode 14

SilvanTheuma avatar Sep 26 '22 16:09 SilvanTheuma

hello, any news about this issue???

cccolo avatar Sep 28 '22 14:09 cccolo

Having same issue with Xcode 14

cemocanon avatar Sep 29 '22 13:09 cemocanon

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

cccolo avatar Sep 29 '22 14:09 cccolo

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

RCBiczok avatar Sep 30 '22 20:09 RCBiczok

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

DevelopCarlosWM avatar Oct 06 '22 06:10 DevelopCarlosWM

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)

'''

skunchamwar1 avatar Oct 11 '22 13:10 skunchamwar1

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

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

thanhdevapp avatar Oct 16 '22 18:10 thanhdevapp

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

zacdemi avatar Oct 19 '22 12:10 zacdemi

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

maiajhonathan avatar Oct 25 '22 02:10 maiajhonathan

same issue here

Moatezz avatar Nov 07 '22 01:11 Moatezz

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.

Abeinevincent avatar Nov 13 '22 05:11 Abeinevincent

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

clarklight avatar Sep 04 '23 06:09 clarklight

"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?

carlgrob5171989 avatar Oct 09 '23 12:10 carlgrob5171989

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

RCBiczok avatar Oct 17 '23 18:10 RCBiczok

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

viljark avatar Oct 19 '23 22:10 viljark