realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.74k stars 565 forks source link

Unable to resolve "bson" from "node_modules/realm/dist/bundle.react-native.mjs" #5791

Closed devsales closed 1 year ago

devsales commented 1 year ago

How frequently does the bug occur?

Always

Description

I just tried to update the Expo SDK to 48 and according to the compatibility matrix I have to use realm: 12.0.0-alpha.2. So after updating both I'm getting this error when running "expo run:ios"

Unable to resolve "bson" from "node_modules/realm/dist/bundle.react-native.mjs"

Here is the list of dependencies:

"@expo/vector-icons": "^13.0.0",
"@gorhom/bottom-sheet": "^4",
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-community/datetimepicker": "6.7.3",
"@react-native-community/netinfo": "9.3.7",
"@react-native-segmented-control/segmented-control": "2.4.0",
"@react-navigation/bottom-tabs": "^6.5.7",
"@react-navigation/native": "^6.1.6",
"@react-navigation/stack": "^6.3.16",
"@realm/react": "0.4.3",
"@turf/turf": "^6.5.0",
"calendarize": "^1.1.1",
"date-fns": "^2.29.3",
"dayjs": "^1.11.7",
"expo": "~48.0.15",
"expo-dev-client": "~2.2.1",
"expo-linear-gradient": "~12.1.2",
"expo-localization": "~14.1.1",
"expo-network": "~5.2.1",
"expo-splash-screen": "~0.18.2",
"expo-status-bar": "~1.4.4",
"expo-system-ui": "~2.2.1",
"i18next": "^22.4.10",
"intl-pluralrules": "^1.3.1",
"jsonfile": "^6.1.0",
"nice-color-palettes": "^3.0.0",
"react": "18.2.0",
"react-i18next": "^12.2.0",
"react-native": "0.71.7",
"react-native-animatable": "^1.3.3",
"react-native-bouncy-checkbox": "^3.0.7",
"react-native-bouncy-checkbox-group": "^0.1.1",
"react-native-calendars": "^1.1293.0",
"react-native-draggable-flatlist": "^4.0.1",
"react-native-gesture-handler": "~2.9.0",
"react-native-get-random-values": "~1.8.0",
"react-native-maps": "1.3.2",
"react-native-modal-datetime-picker": "^14.0.1",
"react-native-modalize": "^2.1.1",
"react-native-purchases": "^5.13.3",
"react-native-reanimated": "~2.14.4",
"react-native-redash": "^18.1.0",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.20.0",
"react-native-shared-element": "0.8.8",
"react-native-typography": "^1.4.1",
"react-navigation-shared-element": "^3.1.3",
"realm": "12.0.0-alpha.2"

After installing "bson": "^5.2.0" as a dependency I got it working. But is this necessary?

I also see two warnings when installing bson: warning " > @realm/react@0.4.3" has incorrect peer dependency "realm@^11.0.0-rc || ^11.0.0". warning " > realm@12.0.0-alpha.2" has incorrect peer dependency "bson@^4".

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

0.4.3

What services are you using?

Atlas Device Sync

Are you using encryption?

No

Platform OS and version(s)

iOS 16

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

elle-j commented 1 year ago

@devsales, thanks for taking the time to try out our latest v12 alpha release and was able to find a workaround for the issue!

To remove the warnings regarding incorrect peer dependencies, you can also pin the BSON version to 4.4.1 (bson@4.4.1) for now. So yes, this is currently necessary, but we will look into a possible BSON upgrade for our final v12 release.

Thanks again for reporting the issue! 👍

devsales commented 1 year ago

@elle-j cool, thanks for the tip! Btw I switched to v11.8.0 and it is also working with Expo SDK 48.

elle-j commented 1 year ago

Very good to know 🙂 Feel free to keep trying out the v12 alpha if you want, we definitely welcome feedback.