realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

Realm module not found

Open Pulse-Git opened this issue 1 year ago • 6 comments

How frequently does the bug occur?

All the time

Description

When I create a new NPM Package and install realm with npm install realm and will require realm in the script const Realm = require("realm"); I'm always getting an error where the module realm.node could not be found, is this a known issue?

This error occurs on all realm version except: [email protected], I absolutely don't know why

Stacktrace & log output

No response

Can you reproduce the bug?

Yes, always

Reproduction Steps

No response

Version

all? except 11.0.0-rc.1

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

Windows

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

Pulse-Git avatar Sep 20 '22 15:09 Pulse-Git

@Pulse-Git I am sorry to hear that Realm is not working for you.

Is is working for v11.0.0-rc.1 but not v10.21.1? What about v11.0.0-rc.2?

Which version of Windows do you use?

Please post the output of npm install --verbose [email protected] (replace version with a version where you cannot load realm.node)

kneth avatar Sep 21 '22 08:09 kneth

@kneth rc.2 is also not working

Windows version: Windows 10.0.19044 Build 19044

output of your command with with [email protected]

npm install --verbose [email protected]

npm install --verbose [email protected] npm verb cli [ npm verb cli 'C:\Program Files\nodejs\node.exe', npm verb cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', npm verb cli 'install', npm verb cli '--verbose', npm verb cli '[email protected]' npm verb cli ] npm info using [email protected] npm info using [email protected] npm timing npm:load:whichnode Completed in 1ms npm timing config:load:defaults Completed in 1ms npm timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms npm timing config:load:builtin Completed in 2ms npm timing config:load:cli Completed in 2ms npm timing config:load:env Completed in 1ms npm timing config:load:file:X:\Pulse-REST.npmrc Completed in 1ms npm timing config:load:project Completed in 1ms npm timing config:load:file:C:\Users\admin.npmrc Completed in 0ms npm timing config:load:user Completed in 0ms npm timing config:load:file:C:\Users\admin\AppData\Roaming\npm\etc\npmrc Completed in 0ms npm timing config:load:global Completed in 0ms npm timing config:load:validate Completed in 0ms npm timing config:load:credentials Completed in 1ms npm timing config:load:setEnvs Completed in 1ms npm timing config:load Completed in 9ms npm timing npm:load:configload Completed in 9ms npm timing npm:load:setTitle Completed in 0ms npm timing npm:load:setupLog Completed in 1ms npm timing config:load:flatten Completed in 3ms npm timing npm:load:cleanupLog Completed in 2ms npm timing npm:load:configScope Completed in 0ms npm timing npm:load:projectScope Completed in 1ms npm timing npm:load Completed in 30ms npm timing arborist:ctor Completed in 1ms npm timing idealTree:init Completed in 145ms npm timing idealTree:userRequests Completed in 1ms npm http fetch GET 200 https://registry.npmjs.org/realm 515ms (cache revalidated) npm timing arborist:ctor Completed in 0ms npm http fetch GET 200 https://registry.npmjs.org/react-native 247ms (cache updated) npm http fetch GET 200 https://registry.npmjs.org/react 77ms (cache revalidated) npm timing idealTree:#root Completed in 887ms npm timing idealTree:node_modules/realm Completed in 0ms npm timing idealTree:buildDeps Completed in 890ms npm timing idealTree:fixDepFlags Completed in 3ms npm timing idealTree Completed in 1044ms npm timing reify:loadTrees Completed in 1045ms npm timing reify:diffTrees Completed in 38ms npm timing reify:retireShallow Completed in 13ms npm timing reify:createSparse Completed in 1ms npm timing reify:loadBundles Completed in 0ms npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 272ms npm timing auditReport:getReport Completed in 275ms npm timing auditReport:init Completed in 0ms npm timing reify:audit Completed in 276ms npm timing reifyNode:node_modules/realm Completed in 2172ms npm timing reify:unpack Completed in 2173ms npm timing reify:unretire Completed in 0ms npm timing build:queue Completed in 1ms npm info run [email protected] install node_modules/realm prebuild-install --tag-prefix= -r napi || cmake-js build npm info run [email protected] install { code: 0, signal: null } npm timing build:run:install:node_modules/realm Completed in 2981ms npm timing build:run:install Completed in 2981ms npm info run [email protected] postinstall node_modules/realm node scripts/submit-analytics.js npm info run [email protected] postinstall { code: 0, signal: null } npm timing build:run:postinstall:node_modules/realm Completed in 2159ms npm timing build:run:postinstall Completed in 2159ms npm timing build:deps Completed in 5145ms npm timing build Completed in 5145ms npm timing reify:build Completed in 5146ms npm timing reify:trash Completed in 417ms npm timing reify:save Completed in 40ms npm timing reify Completed in 8905ms

Kinda strange, only have Realm in the Package.json as dependencie

running the same code with rc.1 its working: npm install --verbose [email protected]

Output where its working:

npm install --verbose [email protected] npm verb cli [ npm verb cli 'C:\Program Files\nodejs\node.exe', npm verb cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', npm verb cli 'install', npm verb cli '--verbose', npm verb cli '[email protected]' npm verb cli ] npm info using [email protected] npm info using [email protected] npm timing npm:load:whichnode Completed in 1ms npm timing config:load:defaults Completed in 2ms npm timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms npm timing config:load:builtin Completed in 2ms npm timing config:load:cli Completed in 2ms npm timing config:load:env Completed in 0ms npm timing config:load:file:X:\Pulse-REST.npmrc Completed in 0ms npm timing config:load:project Completed in 1ms npm timing config:load:file:C:\Users\admin.npmrc Completed in 0ms npm timing config:load:user Completed in 0ms npm timing config:load:file:C:\Users\admin\AppData\Roaming\npm\etc\npmrc Completed in 1ms npm timing config:load:global Completed in 1ms npm timing config:load:validate Completed in 0ms npm timing config:load:credentials Completed in 1ms npm timing config:load:setEnvs Completed in 1ms npm timing config:load Completed in 10ms npm timing npm:load:configload Completed in 10ms npm timing npm:load:setTitle Completed in 0ms npm timing npm:load:setupLog Completed in 0ms npm timing config:load:flatten Completed in 4ms npm timing npm:load:cleanupLog Completed in 4ms npm timing npm:load:configScope Completed in 0ms npm timing npm:load:projectScope Completed in 0ms npm timing npm:load Completed in 50ms npm timing arborist:ctor Completed in 2ms npm timing idealTree:init Completed in 103ms npm timing idealTree:userRequests Completed in 2ms npm timing arborist:ctor Completed in 0ms npm http fetch GET 200 https://registry.npmjs.org/realm 74ms (cache hit) npm http fetch GET 200 https://registry.npmjs.org/react-native 12ms (cache hit) npm http fetch GET 200 https://registry.npmjs.org/react 9ms (cache hit) npm http fetch GET 200 https://registry.npmjs.org/clang-format 791ms (cache revalidated) npm timing idealTree:#root Completed in 934ms npm http fetch GET 200 https://registry.npmjs.org/async 59ms (cache revalidated) npm http fetch GET 200 https://registry.npmjs.org/glob 103ms (cache revalidated) npm http fetch GET 200 https://registry.npmjs.org/resolve 129ms (cache revalidated) npm timing idealTree:node_modules/realm Completed in 134ms npm http fetch GET 200 https://registry.npmjs.org/path-is-absolute 69ms (cache revalidated) npm http fetch GET 200 https://registry.npmjs.org/minimatch 70ms (cache revalidated) npm http fetch GET 200 https://registry.npmjs.org/is-core-module 91ms (cache revalidated) npm http fetch GET 200 https://registry.npmjs.org/path-parse 133ms (cache revalidated) npm http fetch GET 200 https://registry.npmjs.org/inflight 137ms (cache revalidated) npm http fetch GET 200 https://registry.npmjs.org/fs.realpath 139ms (cache revalidated) npm http fetch GET 200 https://registry.npmjs.org/supports-preserve-symlinks-flag 155ms (cache revalidated) npm timing idealTree:node_modules/clang-format Completed in 165ms npm timing idealTree:node_modules/async Completed in 0ms npm http fetch GET 200 https://registry.npmjs.org/brace-expansion 74ms (cache revalidated) npm timing idealTree:node_modules/glob Completed in 83ms npm timing idealTree:node_modules/fs.realpath Completed in 0ms npm timing idealTree:node_modules/inflight Completed in 0ms npm http fetch GET 200 https://registry.npmjs.org/balanced-match 50ms (cache revalidated) npm http fetch GET 200 https://registry.npmjs.org/concat-map 64ms (cache revalidated) npm timing idealTree:node_modules/minimatch Completed in 69ms npm timing idealTree:node_modules/brace-expansion Completed in 3ms npm timing idealTree:node_modules/balanced-match Completed in 0ms npm timing idealTree:node_modules/concat-map Completed in 0ms npm timing idealTree:node_modules/path-is-absolute Completed in 0ms npm http fetch GET 200 https://registry.npmjs.org/has 50ms (cache revalidated) npm timing idealTree:node_modules/resolve Completed in 55ms npm http fetch GET 200 https://registry.npmjs.org/function-bind 54ms (cache revalidated) npm timing idealTree:node_modules/is-core-module Completed in 56ms npm timing idealTree:node_modules/has Completed in 2ms npm timing idealTree:node_modules/function-bind Completed in 0ms npm timing idealTree:node_modules/path-parse Completed in 0ms npm timing idealTree:node_modules/supports-preserve-symlinks-flag Completed in 0ms npm timing idealTree:buildDeps Completed in 1515ms npm timing idealTree:fixDepFlags Completed in 2ms npm timing idealTree Completed in 1627ms npm timing reify:loadTrees Completed in 1629ms npm timing reify:diffTrees Completed in 7ms npm timing reify:retireShallow Completed in 2ms npm timing reify:createSparse Completed in 4ms npm timing reify:loadBundles Completed in 0ms npm timing reifyNode:node_modules/path-is-absolute Completed in 147ms npm timing reifyNode:node_modules/path-parse Completed in 150ms npm timing reifyNode:node_modules/brace-expansion Completed in 149ms npm timing reifyNode:node_modules/inflight Completed in 150ms npm timing reifyNode:node_modules/balanced-match Completed in 153ms npm timing reifyNode:node_modules/has Completed in 155ms npm timing reifyNode:node_modules/minimatch Completed in 155ms npm timing reifyNode:node_modules/fs.realpath Completed in 157ms npm timing reifyNode:node_modules/concat-map Completed in 163ms npm timing reifyNode:node_modules/glob Completed in 163ms npm timing reifyNode:node_modules/is-core-module Completed in 168ms npm timing reifyNode:node_modules/supports-preserve-symlinks-flag Completed in 168ms npm timing reifyNode:node_modules/function-bind Completed in 170ms npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 222ms npm timing auditReport:getReport Completed in 225ms npm timing auditReport:init Completed in 0ms npm timing reify:audit Completed in 227ms npm timing reifyNode:node_modules/clang-format Completed in 231ms npm timing reifyNode:node_modules/resolve Completed in 264ms npm timing reifyNode:node_modules/async Completed in 1029ms npm timing reifyNode:node_modules/realm Completed in 2127ms npm timing reify:unpack Completed in 2129ms npm timing reify:unretire Completed in 0ms npm timing build:queue Completed in 2ms npm timing build:link:node_modules/resolve Completed in 5ms npm timing build:link:node_modules/clang-format Completed in 7ms npm timing build:link Completed in 8ms npm info run [email protected] install node_modules/realm prebuild-install --tag-prefix= -r napi || cmake-js build npm info run [email protected] install { code: 0, signal: null } npm timing build:run:install:node_modules/realm Completed in 262ms npm timing build:run:install Completed in 263ms npm info run [email protected] postinstall node_modules/realm node scripts/submit-analytics.js npm info run [email protected] postinstall { code: 0, signal: null } npm timing build:run:postinstall:node_modules/realm Completed in 1792ms npm timing build:run:postinstall Completed in 1793ms npm timing build:deps Completed in 2069ms npm timing build Completed in 2070ms npm timing reify:build Completed in 2072ms npm timing reify:trash Completed in 45ms npm timing reify:save Completed in 41ms npm timing reify Completed in 5959ms

Same issue when im only using npm install realm

Pulse-Git avatar Sep 21 '22 09:09 Pulse-Git

@Pulse-Git The installation seems to run smoothly. If you are using WSL, please tell us the output of file node_modules/realm/build/Release/realm.node.

kneth avatar Sep 21 '22 11:09 kneth

@kneth i don't have installed the WSL and i think I'm not using it.

Pulse-Git avatar Sep 21 '22 12:09 Pulse-Git

@Pulse-Git Can you check the size of node_modules/realm/build/Release/realm.node?

I have very little experience with Windows, and I hope that https://stackoverflow.com/questions/9587665/nodejs-cannot-find-installed-module-on-windows can give you some ideas.

kneth avatar Sep 21 '22 14:09 kneth

@kneth its around 6MB

That stackoverflow problem is not the same as mine since realm.node exists.. But it didnt find or load it on another version... mh Maybe the shipped .node file is broken?

Pulse-Git avatar Sep 21 '22 14:09 Pulse-Git

@Pulse-Git We are able to reproduce it at our end. We need to investigate why our Windows builds are producing incorrect binaries. It might be related to https://github.com/realm/realm-js/issues/4857

kneth avatar Sep 23 '22 10:09 kneth

@kneth Ah that would make sense. In theory, when i build it by my own it should work

Pulse-Git avatar Sep 23 '22 11:09 Pulse-Git

In theory, when i build it by my own it should work

Yes, and if you can build it, it can help us understand what is wrong with our environment

kneth avatar Sep 23 '22 12:09 kneth

Hm, this is the issue I should have commented on!

https://github.com/realm/realm-js/issues/4675#issuecomment-1254029722

I'm experiencing the same... this is what file realm.node produces on WSL: realm.node: PE32+ executable (DLL) (console) x86-64, for MS Windows

I have tried to build realm.node myself following the build instructions, and I have tried swapping that with the one that is shipped in the package, same error (Error: The specified module could not be found.)

Trying to run realm version 10.21.1

Running Windows 11 Version 10.0.22000 Build 22000

EDIT: Can verify that [email protected] works, but not rc.2

blaykelarue avatar Sep 23 '22 16:09 blaykelarue

Interesting thought, im doing something wrong with building.

@blaykelarue same issue, when i build by myself and swap the file. Im also getting the same error. Windows 10.0.19044 Build 19044

Pulse-Git avatar Sep 24 '22 05:09 Pulse-Git

@Pulse-Git Can you check the size of node_modules/realm/build/Release/realm.node?

Size is about 6MB

realm.node.zip

kpostekk avatar Sep 26 '22 15:09 kpostekk

@kpostekk did [email protected] work for you?

Pulse-Git avatar Sep 26 '22 15:09 Pulse-Git

@kpostekk did [email protected] work for you?

Yup

kpostekk avatar Sep 26 '22 15:09 kpostekk

I think I had a similar problem, when starting the app on an android emulator it'd automatically close. This happened with version [email protected] and above, except for [email protected]. Fixed it by downgrading react-native from 0.70.1 to 0.69.6

RenaudAubert avatar Sep 27 '22 13:09 RenaudAubert

@RenaudAubert mhh this issue here should be windows related not android

Pulse-Git avatar Sep 28 '22 15:09 Pulse-Git

@Pulse-Git Maybe it's somehow realted, I really don't know. I just wanted to share because I've had the exact same problem you're describing except it was an android emulator running on windows.

RenaudAubert avatar Sep 29 '22 07:09 RenaudAubert

I think it's related, because realm dependecy (even though it targets android) is build on windows and after that, it's copied to emulator or release build.

kpostekk avatar Sep 29 '22 07:09 kpostekk

We have merged a fix for the Windows issue (https://github.com/realm/realm-js/pull/4954), and we will release it soon.

kneth avatar Sep 29 '22 07:09 kneth

The fix has been released in v10.22.0.

kneth avatar Oct 20 '22 11:10 kneth