Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v12 RC with Yarn: Unable to resolve "bson" from "node_modules/realm/dist/bundle.react-native.js" #6040

Closed
Acetyld opened this issue Aug 6, 2023 · 7 comments · Fixed by #6043

Comments

@Acetyld
Copy link

Acetyld commented Aug 6, 2023

How frequently does the bug occur?

Always

Description

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

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

Clean expo project, make a dev build, add "realm": "^12.0.0-rc.3",

Version

12.0.0-rc.3

What services are you using?

  • select --

Are you using encryption?

No

Platform OS and version(s)

expo 49 0.72.3

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

@takameyer
Copy link
Contributor

takameyer commented Aug 7, 2023

Hi @Acetyld, I would really like to reproduce this so we can get this resolved. Here are the steps I've have done:

npx create-expo-app bsonTest
cd bsonTest
npm install -D expo-dev-client
npm install [email protected]
npx expo run:ios

This works without failure. I have also added in the App.tsx

import Realm from "realm";

const realm = new Realm();
console.log(realm.schemaVersion); // outputs -1

This has worked for me with the node 16 and 18 as well as npm 8 and 9. bson is marked as a peerDependency, and since version 7 of npm it should be automatically installed. Can you verify what versions of npm and node you are using?
Also if I am missing any steps to reproduce this. Thanks for helping us out!

@Acetyld
Copy link
Author

Acetyld commented Aug 7, 2023

Node: v18.17.0
NPM: 9.6.7

Also another thing i noticed, using newest expo dev client + realm was giving me the issue that the metro was stuck at 100% and i got a black screen, after a solid 2 hours of debuggin i noticed this only happend when flipper was open before starting metro load, if i disable flipper and then open app it works, after that i can safely open flipper
i reproduced this as well: https://github.com/Acetyld/realm-test-expo

@takameyer
Copy link
Contributor

@Acetyld Alright, so this happens when upgrading, but not when installing realm into a clean project. Thanks for the hint there.
We will have to investigate the flipper issue as well. Can you create a new issue so we can track this? Also providing the version of flipper you are using would be great.

@takameyer
Copy link
Contributor

@Acetyld Actually it's not upgrading that is the issue. It's yarn. It appears yarn does not install peerDependency automatically.

@Acetyld
Copy link
Author

Acetyld commented Aug 7, 2023

@Acetyld correct! I am using yarn, 100% correct about that one.
Also: #6042 made it

@takameyer takameyer changed the title On a clean project i get: Unable to resolve "bson" from "node_modules/realm/dist/bundle.react-native.js" v12 RC with Yarn: Unable to resolve "bson" from "node_modules/realm/dist/bundle.react-native.js" Aug 7, 2023
@takameyer
Copy link
Contributor

This will be fixed in the next release. For now, yarn add bson@4 would be the suggested workaround.

@Acetyld
Copy link
Author

Acetyld commented Aug 8, 2023

Perfect.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants