Hello,
I am trying to use Realm in my react-native application
I have installed the following package :
npm install realm
npm install @realm/react
Also followed the explanation from Using Expo and Realm React Native with expo-dev-client | MongoDB
I have clone the repository GitHub - mongodb-developer/read-it-later-maybe: Offline-First React Native Mobile App with Expo and Realm and tried to launch the android app but it always crashed.
When i execute the app in the web browser i get the following error :
NODE_OPTIONS=--openssl-legacy-provider expo start --web
WARNING: The legacy expo-cli does not support Node +17. Migrate to the versioned Expo CLI (npx expo).
This command is being executed with the global Expo CLI. Learn more.
To use the local CLI instead (recommended in SDK 46 and higher), run:
โบ npx expo start
Starting project at /home/cyril/Adoption/ReactRealmJSTemplateApp
Starting Metro Bundler
Starting Webpack on port 19006 in development mode.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โโโโโ โโโ โโโโโ โโโโโ โโโโโ โ
โ โ โ โโโโโ โโ โโโโโโ โ โ โ
โ โโโโโ โโ โโโโโโ โโโโโ โโโโโ โ
โโโโโโโโโโโ โโโ โ โ โโโโโโโโโโโ
โโโโ โโโโโโโโ โโโโโ โโโโโโโโโโ
โโโโโ โโโโโโโโโโ โโ โโโโโ โโโโโ
โ โโโโ โโโโโโโโโโโโโ โโโโโโ โโโ
โ โโโ โโ โโ โโ โ โ โโ โโโโโโโโ
โ โโโ โโโโโ โโโโโโ โโ โโโโ โโโ
โ โ โ โโโโโโโ โโ โโโโโ โโโโโโโ
โโโโโโโโโโโโโโโโโโโโโ โโโ โ โ
โ โโโโโ โโ โ โโโ โโโโ โโโ โโโโโ
โ โ โ โ โโโโโโโ โโโ โ โโโ โ
โ โโโโโ โ โโโ โ โโโโ โโโ โโ โโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โบ Metro waiting on exp://192.168.1.139:19000
โบ Scan the QR code above with Expo Go (Android) or the Camera app (iOS)
โบ Webpack waiting on http://192.168.1.139:19006
โบ Expo Webpack (web) is in beta, and subject to breaking changes!
โบ Press a โ open Android
โบ Press w โ open web
โบ Press r โ reload app
โบ Press m โ toggle menu
โบ Press ? โ show all commands
Logs for your project will appear below. Press Ctrl+C to exit.
[object Object]
[object Object]
[object Object]
WARNING in ./node_modules/@realm/react/dist/AppProvider.js
Module Warning (from ../../.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/AppProvider.tsx' file: Error: ENOENT: no such file or directory, open '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/AppProvider.tsx'
WARNING in ./node_modules/@realm/react/dist/RealmProvider.js
Module Warning (from ../../.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/RealmProvider.tsx' file: Error: ENOENT: no such file or directory, open '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/RealmProvider.tsx'
WARNING in ./node_modules/@realm/react/dist/UserProvider.js
Module Warning (from ../../.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/UserProvider.tsx' file: Error: ENOENT: no such file or directory, open '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/UserProvider.tsx'
WARNING in ./node_modules/@realm/react/dist/cachedCollection.js
Module Warning (from ../../.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/cachedCollection.ts' file: Error: ENOENT: no such file or directory, open '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/cachedCollection.ts'
WARNING in ./node_modules/@realm/react/dist/cachedObject.js
Module Warning (from ../../.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/cachedObject.ts' file: Error: ENOENT: no such file or directory, open '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/cachedObject.ts'
WARNING in ./node_modules/@realm/react/dist/index.js
Module Warning (from ../../.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/index.tsx' file: Error: ENOENT: no such file or directory, open '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/index.tsx'
WARNING in ./node_modules/@realm/react/dist/useObject.js
Module Warning (from ../../.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/useObject.tsx' file: Error: ENOENT: no such file or directory, open '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/useObject.tsx'
WARNING in ./node_modules/@realm/react/dist/useQuery.js
Module Warning (from ../../.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/useQuery.tsx' file: Error: ENOENT: no such file or directory, open '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/useQuery.tsx'
WARNING in ./node_modules/@realm/react/dist/useRealm.js
Module Warning (from ../../.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/useRealm.tsx' file: Error: ENOENT: no such file or directory, open '/home/cyril/Adoption/ReactRealmJSTemplateApp/node_modules/@realm/react/src/useRealm.tsx'
ERROR in ./node_modules/bindings/bindings.js:5
Module not found: Can't resolve 'fs'
3 | */
4 |
> 5 | var fs = require('fs'),
6 | path = require('path'),
7 | fileURLToPath = require('file-uri-to-path'),
8 | join = path.join,
ERROR in ./node_modules/bindings/bindings.js:6
Module not found: Can't resolve 'path'
4 |
5 | var fs = require('fs'),
> 6 | path = require('path'),
7 | fileURLToPath = require('file-uri-to-path'),
8 | join = path.join,
9 | dirname = path.dirname,
ERROR in ./node_modules/file-uri-to-path/index.js:6
Module not found: Can't resolve 'path'
4 | */
5 |
> 6 | var sep = require('path').sep || '/';
7 |
8 | /**
9 | * Module exports.
web compiled with 3 errors and 9 warnings
Started Metro Bundler
What can i do to fix this issue and make realm compatible with react-native and expo ?
Is it a version issue?(the documentation asks for Node 12 or higher)
If the version is the issue, which version should i use?
Additional information about my versions:
ย ย Node : v18.12.1
ย ย expo-cli : 6.3.0
ย ย โ@realm/reactโ: โ^0.4.3โ,
ย ย โexpoโ: โ~47.0.12โ,
ย ย โexpo-dev-clientโ: โ~2.0.1โ,
ย ย โmetro-coreโ: โ^0.75.0โ,
ย ย โreactโ: โ18.1.0โ,
ย ย โreact-nativeโ: โ0.70.5โ,
ย ย โrealmโ: โ^11.4.0โ,