I’m trying to create node server using Realm. I have installed Realm like the docs say: npm install realm
. The module is visible in node_modules
folder and package.json
.
I try to import Realm like the docs say too:
const Realm = require("realm");
But this import throws an error (it’s in my language, so translation of the error message might be not word-to-word):
> Error: cannot find module:
> \\?\D:\GIT\nuxt-test\node_modules\realm\build\Release\realm.node
> at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
> at Module.load (internal/modules/cjs/loader.js:600:32)
> at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
> at Function.Module._load (internal/modules/cjs/loader.js:531:3)
> at Module.require (internal/modules/cjs/loader.js:637:17)
> at require (internal/modules/cjs/helpers.js:22:18)
> at bindings (D:\GIT\nuxt-test\node_modules\bindings\bindings.js:112:48)
> at getRealmConstructor (D:\GIT\nuxt-test\node_modules\realm\lib\index.js:37:43)
> at Object.<anonymous> (D:\GIT\nuxt-test\node_modules\realm\lib\index.js:62:26)
> at Module._compile (internal/modules/cjs/loader.js:701:30)
I’m working on Windows 7 with Node version: 16.4 (upgraded from 10.15.3 trying to solve this).
Could anyone suggest what I should do in this situation? I cannot use Realm.
EDIT: I have noticed that on installation of Realm npm throws some warnings:
realm@10.5.0 requires a peer of react-native@>=0.60 but none is installed.
deprecated-react-native-listview@0.0.6 requires a peer of react@* but none is installed.
which is surprising as I’m not using react-native
SDK, but the node
one.
I tried to install realm-web
package and it seems to function properly (!) even though I run it from node
. But I don’t know if this is an acceptable solution as docs say the realm-web
package is not intended for node
.