Missing Realm constructor



I am getting this error when I try to require ‘realm’ in my App.

"Missing Realm constructor". Did you run "react-native link realm" ...

These are the steps I took to create my app.

create-react-native-app RealmApp

npm install --save realm

react-native link realm

and then I went to Expo app and started the server.


import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

const Realm = require('realm');

export default class App extends React.Component {
  render() {

     let realm = new Realm({
       schema: [{
         name: 'Dog',
         properties: {
           name: 'string'

     realm.write(() => {
       realm.create('Dog', {
         name: 'Rex'

    return (
      <View style={styles.container}>
         Count of Dogs in Realm: {realm.objects('Dog').length}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',


Have you tried all the troubleshooting steps here?


Yes, but I had no success.

Does Realm works with create-react-native-app 'project ’ or do I need to use react-native init ‘project’?


Any updates here? Have the same error


I am having the same issue. I’m using create-react-native-app ‘project’ so I can not do the first troubleshooting step which is react-native link realm. Can someone please help?