Open ansarizafar opened 1 year ago
@ansarizafar Realm doesn't support Bun yet.
The error message you see is cause by the fact that Bun doesn't run the post-install script.
To support Bun is not a trivial project. It includes:
I will leave the issue open, and please upvote the issue if you believe Bun support is important for you.
Bun is an important Javascript runtime which is faster than both Node and Deno. Realm must add support for Bun. I badly need it for our next project.
- Integration will Bun's event loop
- Add integration with JavaScriptCore (a target in our binding generator)
- Integrate with Bun's initialization of C++ code
Bun implements napi, so a lot of the work is already done for you
We do not implement libuv symbols yet, and it looks like Realm is using libuv symbols when used with Node.js
If your target is >= C++17, you could probably get away with using std::filesystem instead
Thank you @Jarred-Sumner for pointing out that Bun is using N-API. Our dependency on libuv
is a bit more complex than file operations: we rely heavily on the event loop to drive our change listeners, and we need to implement a scheduler for Bun's event loop. I guess we need to study Bun a bit closer.
Is there any new update? I badly need this.
the realm eng team does not intend to work on adding support for Bun at this time. Of course, Realm is open-source so you are more than free to take a swing at implementing it yourself. And we are happy to accept PRs back from our community.
How frequently does the bug occur?
Always
Description
When I try to import realm in a js file and run the script with Bunjs, I get the following error error: Cannot find module "realm/realm-constants.json" from "/home/zafaransari/projects/bun/realmdb/node_modules/realm/dist/bundle.node.js"
Stacktrace & log output
Can you reproduce the bug?
Always
Reproduction Steps
install realm using command bun add realm import realm in a js file Run the js file with the command bun run index,js
Version
12.2.0
What services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
Ubuntu 22.04.3 LTS
Build environment
Which debugger for React Native: ..
Cocoapods version
No response