Missin Realm Constructor error

Hi, I perfectly followed the instructions that the documentation reported, but every time I start my app it gives me the Missing Realm Constructor error and I don’t understand how to fix it, can you help me thanks. I use all the latest versions of React Native, Realm and Expo

@Samuele_Cervietti This typically happens when the Realm .so is not linked into the compiled React Native project. Verify that pod install has indeed included Realm and do a rebuild of the project.

Also I see you are using Expo. If you are attempting to use the web browser, then this error will also come up, as we are only compatible with Android and iOS.

Can you provide a link to the documentation you are following? I can verify if something is missing.

@Andrew_Meyer sorry but at the moment i am not home for work, as soon as i come back i will let you know, just one thing but i need to link my react native project with realm? It seemed to me that after version 0.65 it was no longer necessary

You won’t have to manually link anything. Did you follow our Expo documentation?

This is based off of a template we created to help get started using Realm in React Native. Might be a good starting point to figuring out what is happening in your project.

I had already created the project for some time, I just wanted to integrate Realm, can you advise me to create a new project and reinstall everything?

It should work without creating a new project. But if you are using expo, you will need to use the expo-dev-client. This allows you to use 3rd party libraries in an Expo project. Here’s the getting started documentation. Once you have that setup, you should be able to use Realm.

Hi, I had already tried to use Expo-dev-client but without result, because when I launch the app through “expo start --dev-client” it doesn’t load the app when I try to open it with the expo app on play store

Expo-dev-client is not compatible with Expo Go. You will have to build a dev client and install it on your device. Have you tried use the a simulator or emulator?

I haven’t tried any emulator yet, now I try, in case how do I create a development client? Excuse the many questions but it is the first time that such a thing has happened to me

@Andrew_Meyer i tried with the emulator but it keeps giving me the same error ie that the realm constructor is missing. I followed the whole procedure but it didn’t lead to anything, what can I do?

It’s hard to say without seeing the exact instructions you are using to install and run your project. I recommend trying out our expo-template and comparing the project contents to your project once you get that up and running. Maybe you will be able to find the issue through comparing a working realm project to yours.

Okay, I saw that there is also the javascript version, is it okay if I try this? realm-js/templates/expo-template-js at master · realm/realm-js · GitHub

1 Like

I tried to install the Expo templates with realm, but both the typescript and JavaScript templates are not downloaded, when I run the script the download starts and stops almost immediately, creating just the folder, you know how I can

Did you follow the instructions in the README?

yes i read the documentation on README but it keeps giving me that problem

What exact command do you type to produce this error?

I tried to install both the typescript and JavaScript template, the commands I used, are these:

Typescript:
npx create-react-native-app MyAwesomeRealmApp -t with-realm

JavaScript:
expo init MyAwesomeRealmApp --template @realm/expo-template-js

And this fails to download the template? Do other templates (non-realm) work?

Executing the above commands does not download the realm model and gives me the error already mentioned, the other models work, also because I only use the default Expo templates (blank). And then I install the packages I need, I had done this for realm too before I knew it was giving an error

@Samuele_Cervietti I just published new templates for expo. However I have found a bug on the expo-cli. I’m going to reach out to expo and get that fixed. I’ll post here when it’s working again.