Junior Seppo
Junior Seppo

Reputation: 1

Problem SQLite Module on Expo React Native

terminal Screenshot of error

I'm attempting to integrate SQLite into my Expo project using expo-sqlite. However, when I run the project, I encounter the following error:

 (NOBRIDGE) ERROR  Error: Cannot find native module 'ExpoSQLite' [Component Stack]
 (NOBRIDGE) WARN  Route "./note/index.tsx" is missing the required default export. Ensure a React component is exported as default. [Component Stack]

Steps Taken:

Expected Behavior: The project should run successfully and allow me to interact with the SQLite database as per the expo-sqlite documentation.

Environment:

Code Snippet (if applicable):

export default function NoteApp(){
    const store =  useCreateStore(createStore);
    useAndStartPersister(store);

    return(
      // TSX
    )
}

const useAndStartPersister = (store : any) =>
    // Persist store to Expo SQLite or local storage; load once, then auto-save.
    useCreatePersister(
      store,
      (store) =>
        Platform.OS === 'web'
          ? createLocalPersister(store, 'todos')
          : createExpoSqlitePersister(store, SQLite.openDatabaseSync('todos.db')),
      [],
      // @ts-ignore
      (persister) => persister.load().then(persister.startAutoSave)
    );

I have tried reinstalling node modules, clearing cache, etc.

Expected Behavior: The project should run successfully and allow me to interact with the SQLite database as per the expo-sqlite documentation.

Upvotes: 0

Views: 51

Answers (0)

Related Questions