Hey Realm Team.
Having quite a bit of trouble getting Realm to install on a newly ejected create-react-native-app. I've set up previous versions of Realm into Swift and Obj-C projects in the past quite easily, but not having much luck this time around :(
I've followed the installation guide and linked everything correctly, however it seems that there are several files missing from the referenced iOS build directory, specifically:
download-realm.jsdependencies.listThese files exist in the node_modules/realm directory, perhaps they aren't being copied across during the build phase? (Did link perhaps not work correctly?) I've tried copying these files manually into the build folder to see if that fixes it, however, that causes further errors, so I thought it would be good to just resolve this problem.
Funnily enough, if I open the project in Xcode and Build & Run, it builds successfully and launches, not sure what to make of that? ๐คทโโ๏ธ
Edit: Just did a look through all the build phases for the Realm Projects and couldn't find any phases that would copy those files to the build folder.
(I've also seen #1576, and have tried multiple suggested fixes, however, nothing has worked. I don't believe it's an issue with lzma as it can never download the file to being with.)
Install Realm JS onto a new project and build in iOS successfully
react-native run-ios build succeeds
react-native run-ios build fails:
PhaseScriptExecution Download\ Core /Users/aron/Documents/Apps/ReactNative/<app-name>/ios/build/Build/Intermediates.noindex/RealmJS.build/Debug-iphonesimulator/RealmJS.build/Script-F63FF2C51C12462600B3B8E0.sh
When I attempt to execute that script manually, I see the following output:
v7.10.0 is already installed.
Now using node v7.10.0 (npm v4.2.0)
module.js:472
throw err;
^
Error: Cannot find module '/Users/aron/Documents/Apps/ReactNative/<appname>/ios/build/Build/Intermediates.noindex/RealmJS.build/Debug-iphonesimulator/scripts/download-realm.js'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3
Directory of /Users/aron/Documents/Apps/ReactNative/<appname>/ios/build/Build/Intermediates.noindex/RealmJS.build/Debug-iphonesimulator/scripts/:

create-react-native-appyarn add realmreact-native run-iosN/A
Thanks for the help! Let me know if you need any more details ๐
After several more hours of hacking away, I finally found a fix! Indeed it did turn out to be a version mismatch of node between nvm and /usr/local/bin/node, even though Xcode reported it was using the right version, something somewhere along the line was getting confused ๐
After matching both versions to 7.10.0, it all worked. ๐
Hi @abury , may i know how to check the node version of nvm and /usr/local/bin/node? and how to match both the node version? Thank you
Hey @McDreamy
Just do
node --version
and
/usr/local/bin/node --version
You can find more details about this in ticket #1576 ๐
I fix with
sudo link /usr/local/opt/node@8/bin/node /usr/local/bin/node
my node version is v8.14.0.
node --version
/usr/local/bin/node --version
then I use brew install nvm fix it.
react-native run-ios
** BUILD SUCCEEDED **
I fix with
sudo link /usr/local/opt/node@8/bin/node /usr/local/bin/node
OMG @augustocbx thank you so much for that comment!!!
I had nvm installed running node v12.16.3 And I was getting this error:
Showing Recent Issues
/Users/dan/Library/Developer/Xcode/DerivedData/SAFE2-chfsezjzocetykgbnoijoahfwmcw/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/RealmJS.build/Script-E5F3F9F5196957E2E72E143BA53F523C.sh: line 2: node: command not found
Once I had installed node with brew install node@12 I ran sudo link /usr/local/opt/node@12/bin/node /usr/local/bin/node
I noted that it had installed node v12.18.2 so I updated nvm to that version as well :)
And boom we are flying again
__|__
--@--@--(_)--@--@--
Most helpful comment
I fix with
sudo link /usr/local/opt/node@8/bin/node /usr/local/bin/node