Realm-js: PhaseScriptExecution, missing script files for `download-realm` in iOS build folder.

Created on 1 Apr 2018  ยท  6Comments  ยท  Source: realm/realm-js

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:

  • scripts folder with download-realm.js
  • dependencies.list

These 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.)

Goals

Install Realm JS onto a new project and build in iOS successfully

Expected Results

react-native run-ios build succeeds

Actual Results

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/:

screen shot 2018-04-02 at 10 16 19 am

Steps to Reproduce

  • Create new react native app using create-react-native-app
  • Eject
  • yarn add realm
  • Follow realm setup instructions
  • react-native run-ios

Code Sample

N/A

Version of Realm and Tooling

  • Realm JS SDK Version: 2.3.3
  • Node or React Native: React Native
  • Client OS & Version: OSX 10.13.3
  • Which debugger for React Native: None
  • Attempted Node versions: [ v6.11.1, v7.10.0, v9.10.1]

Thanks for the help! Let me know if you need any more details ๐Ÿ‘

Most helpful comment

I fix with

sudo link /usr/local/opt/node@8/bin/node /usr/local/bin/node

All 6 comments

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

       __|__
--@--@--(_)--@--@--
Was this page helpful?
0 / 5 - 0 ratings

Related issues

timanglade picture timanglade  ยท  3Comments

matt2legit picture matt2legit  ยท  3Comments

jmartindivmedianet picture jmartindivmedianet  ยท  3Comments

bdebout picture bdebout  ยท  3Comments

kevinnguy picture kevinnguy  ยท  3Comments