I would like to run tests under NodeJS v7.2. As of v7, the node ABI version was switched from 48 to 51. This causes problems with realm.
Cannot find module '/Users/colinramsay/Projects/clients/clade/clade-app/node_modules/realm/compiled/node-v51_darwin_x64/realm.node' from 'index.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:151:17)
at Object.<anonymous> (node_modules/realm/lib/index.js:43:24)
at Object.<anonymous> (src/app/persistence.js:1:158)
How was this resolved?
We use yarn. When you run yarn add jest, it installs the correct compiled version of realm.node however if you use yarn install then it doesn't. This was causing problems on our CI setup and so we solved it by simply running yarn add realm after yarn install. I didn't have time to track down whether this was an issue with yarn or with realm.
NB: this is my recollection of the issue so some details might be wrong.
Thanks a lot for the response. I'm also using yarn but I can't seem to get it to install realm.node. You didn't have to run a script or anything?
Other than the dance I describe above, no. I think it's somehow handled by npm/yarn:
https://github.com/realm/realm-js/blob/master/package.json#L84
Which versions of realm, react-native, jest, and yarn are you using, if you don't mind me asking?
I can't remember what we were using at the time but we're currently on:
Whoa, that version of Realm seemed to work form me. Thanks a lot for the help!
We're now using a different approach, forcing the install of the binaries.
yarn install
cd node_modules/realm; yarn run install
It appears that this issue is resolved in Yarn: https://github.com/yarnpkg/yarn/pull/800 -- maybe try upgrading it?
Most helpful comment
We're now using a different approach, forcing the install of the binaries.