Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android | react-native - Error: Could not find the Realm binary. #6204

Closed
arshad-slate opened this issue Oct 19, 2023 · 14 comments
Closed

Android | react-native - Error: Could not find the Realm binary. #6204

arshad-slate opened this issue Oct 19, 2023 · 14 comments
Labels

Comments

@arshad-slate
Copy link

arshad-slate commented Oct 19, 2023

How frequently does the bug occur?

Always

Description

I am always getting error " Error: Could not find the Realm binary.". Checked the troubleshooting steps and could see necessary binaries are already downloaded.

Screenshot 2023-10-19 at 6 18 16 PM

hermesEnabled = true
Following are the SDK versions used.

realm": ^12.2.1
@realm/react: ^0.6.1


react-native: 0.71.14
react: 18.2.0,
Node: 18.17.0 
Yarn: 1.22.19 
npm: 9.6.7
Watchman: 2023.09.18.00 

Stacktrace & log output

Error: Could not find the Realm binary. Please consult our troubleshooting guide: https://www.mongodb.com/docs/realm-sdks/js/latest/#md:troubleshooting-missing-binary, js engine: hermes 
    at AppEnv (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.myapp.xxx.staging&modulesOnly=false&runModule=true:96545:122)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com..xxx.staging&modulesOnly=false&runModule=true:46852:43)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.myapp.xxx.staging&modulesOnly=false&runModule=true:46852:43)
    at AppContainer (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.myapp.xxx.staging&modulesOnly=false&runModule=true:46717:36)
    at myapp(RootComponent) (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.myapp.xxx.staging&modulesOnly=false&runModule=true:84655:28)
 LOG  isHermesisHermesisHermesisHermesisHermes isHermes yyyyy ========   true
 ERROR  Error: Could not find the Realm binary. Please consult our troubleshooting guide: https://www.mongodb.com/docs/realm-sdks/js/latest/#md:troubleshooting-missing-binary, js engine: hermes 
    at AppEnv (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.myapp.xxx.staging&modulesOnly=false&runModule=true:96545:122)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.myapp.xxx.staging&modulesOnly=false&runModule=true:46852:43)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.myapp.xxx.staging&modulesOnly=false&runModule=true:46852:43)
    at AppContainer (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.myapp.xxx.staging&modulesOnly=false&runModule=true:46717:36)
    at myapp(RootComponent) (http://localhost:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.myapp.xxx.staging&modulesOnly=false&runModule=true:84655:28)
 ERROR  TypeError: Cannot read property 'Action' of undefined

This error is located at:
    in AppEnv
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in myapp(RootComponent), js engine: hermes
 ERROR  TypeError: Cannot read property 'Action' of undefined

This error is located at:
    in AppEnv
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in myapp(RootComponent), js engine: hermes

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

12.2.1

What services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android API lever 31+

Build environment

realm": ^12.2.1
@realm/react: ^0.6.1


react-native: 0.71.14
react: 18.2.0,
Node: 18.17.0 
Yarn: 1.22.19 
npm: 9.6.7
Watchman: 2023.09.18.00 

Cocoapods version

No response

@takameyer
Copy link
Contributor

@arshad-slate Thanks for posting this. I can't see anything wrong with your setup, so very strange that this is occuring.
Can you verify that our template is working on your machine? If this does not have the error, perhaps it can help guide you to what is causing the issue.

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Oct 19, 2023
@arshad-slate
Copy link
Author

arshad-slate commented Oct 20, 2023

@takameyer Downloading the template gave error you must user ruby >=2.7.0. Mine was 2.6.10. Upgraded ruby version to 3.2.2 and was able to download the template.

I am on macOS 13.6, and Apple M2 chip.

Running template on android throws the following error:

error: Error: Unable to resolve module realm/realm-constants.json from /Users/fuser/Downloads/AwesomeRealmProject/node_modules/realm/dist/bundle.react-native.js: realm/realm-constants.json could not be found within the project or in these directories:
  node_modules/realm/node_modules
  node_modules
  4 | var reactNative = require('react-native');
  5 | var bson = require('bson');
> 6 | var realmConstants_json = require('realm/realm-constants.json');
    |                                    ^
  7 |
  8 | function _interopNamespaceDefault(e) {
  9 |   var n = Object.create(null);
    at ModuleResolver.resolveDependency (/Users/fuser/Downloads/AwesomeRealmProject/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:139:15)
    at DependencyGraph.resolveDependency (/Users/fuser/Downloads/AwesomeRealmProject/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/node-haste/DependencyGraph.js:277:43)
    at Object.resolve (/Users/fuser/Downloads/AwesomeRealmProject/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/lib/transformHelpers.js:169:21)
    at Graph._resolveDependencies (/Users/fuser/Downloads/AwesomeRealmProject/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/Graph.js:473:35)
    at Graph._processModule (/Users/fuser/Downloads/AwesomeRealmProject/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/Graph.js:261:38)
    at async Graph._addDependency (/Users/fuser/Downloads/AwesomeRealmProject/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/Graph.js:372:20)
    at async Promise.all (index 0)
    at async Graph._processModule (/Users/fuser/Downloads/AwesomeRealmProject/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/Graph.js:322:5)
    at async Graph._addDependency (/Users/fuser/Downloads/AwesomeRealmProject/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro/src/DeltaBundler/Graph.js:372:20)
    at async Promise.all (index 8)

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Oct 20, 2023
@takameyer
Copy link
Contributor

@arshad-slate curious...in both projects it appears metro is having issues accessing node_modules/realm. Is there perhaps some sort of global configuration on your system that could be affecting this?

@takameyer
Copy link
Contributor

takameyer commented Oct 20, 2023

@arshad-slate I can reproduce the second issue. We will look into that now. The current workaround would be to use node 16

@takameyer
Copy link
Contributor

@arshad-slate Can you try, in both projects, the following:

rm -rf node_modules/realm
npm install realm

And then try building again. I have witnessed some post-install scripts being skipped with the template and this should make sure our package settles down as expected after install.

@GoodLuckJane
Copy link

I had a very similar issue. I was able to fix it by 'Stop Debugging' on my iOS simulator.

I accidentally found that whenever I chose to 'Debug with Chrome', this issue would reappear.

node version: v18.15.0
"react-native": "0.72.6"
"realm": "^12.3.0"

Hope this helps.

@cyang2020
Copy link

had the same issue where this only appeared in debug mode for IOS

@suntan-superman
Copy link

I have been having the same problem on my Windows machine and using an iOS device for testing. I have downloaded multiple templates and online samples, and get the same problem each and every time. I have tried EVERYTHING. I even download this sample and got the same problem: I even followed this example step-by-step. Everything worked fine until I got to the step where I added the code to import realm: (https://dev.to/aaronksaunders/realm-database-expo-sdk-49-and-expo-router-getting-started-434e). Please help

@suntan-superman
Copy link

@arshad-slate Can you try, in both projects, the following:

rm -rf node_modules/realm
npm install realm

And then try building again. I have witnessed some post-install scripts being skipped with the template and this should make sure our package settles down as expected after install.

The problem persists. I have tried multiple sample projects and templates to no avail. Using Windows, Expo, React Native and an iOS device. FYI, I have successfully used Mongoose with my Web-based app with zero problems.

@damo21
Copy link

damo21 commented Nov 20, 2023

@arshad-slate Can you try, in both projects, the following:

rm -rf node_modules/realm
npm install realm

And then try building again. I have witnessed some post-install scripts being skipped with the template and this should make sure our package settles down as expected after install.

The problem persists. I have tried multiple sample projects and templates to no avail. Using Windows, Expo, React Native and an iOS device. FYI, I have successfully used Mongoose with my Web-based app with zero problems.

same problem for me, you managed to find a way around it?

@suntan-superman
Copy link

suntan-superman commented Nov 20, 2023 via email

@takameyer
Copy link
Contributor

@suntan-superman Your screenshots are not visible. Can you update your comment so we can see what commands you attempted?

@suntan-superman
Copy link

suntan-superman commented Nov 21, 2023 via email

@kneth
Copy link
Contributor

kneth commented Dec 20, 2023

@suntan-superman Expo Go does not support Realm - please see #6193 (comment)

@sync-by-unito sync-by-unito bot added Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention Reporter has responded. Review comment. labels Dec 20, 2023
@nirinchev nirinchev closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2024
@sync-by-unito sync-by-unito bot closed this as completed Mar 20, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants