I tried import realm-js in my electron app.
at first, i installed and used require('realm') in my javascript code.
but when i started app, error occured like this
App threw an error during load
Error: Cannot find module '/home/youngkyun/git/multipad/node_modules/realm/compiled/electron-v1.4_linux_x64/realm.node'
at Module._resolveFilename (module.js:455:15)
at Function.Module._resolveFilename (/home/youngkyun/git/multipad/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/youngkyun/git/multipad/node_modules/realm/lib/index.js:41:24)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
as you see, log's path is
/home/youngkyun/git/multipad/node_modules/realm/compiled/electron-v1.4_linux_x64/realm.node
and installed path what i found was
/home/youngkyun/git/multipad/node_modules/realm/compiled/node-v51_linux_x64/realm.node
and other test electron apps was same.
i can't figure out what is a problem.
Hi @chancethecoder, just to be clear, we are not officially supporting Electron yet. People have managed to make it work but we haven't put in the work to offer proper support yet. I will look into this when I have some time.
@chancethecoder try to use electron-rebuild to rebuild Realm against the currently installed Electron version.
electron-rebuild -f -w realm
@kristiandupont thank you!
@chancethecoder did you fixed this error with electron-rebuild?
Note that we've seen this problem appear with the newest version of electron-rebuild. It seems that they have fixed it so it shouldn't be a problem for long.
@kristiandupont Thank you!
I have it working in the main process but if you try to access the realm in the renderer process then it will try to look for react-native
:-p
Thank you much for the clarifications.
Have a nice weekend
Realm Studio is an Electron app, and you are welcome to see how we are using Realm JS and Electron together.
Most helpful comment
Note that we've seen this problem appear with the newest version of
electron-rebuild. It seems that they have fixed it so it shouldn't be a problem for long.