I get this error when trying to build any (new or old) project. My node is on version 4.2.1 and react-native is on version 0.1.7. I've looked at other people with the same problem so I've updated react-native to the latest version however I still cannot build any project through xcode.
5 Answers
If you are using RN 0.46 or above:
There is a breaking change made by Facebook: the location of the script has been changed, more detail here
I was able to solve this error by:
- Opening the project in XCode
- Navigate to
Build Phases > Bundle React Native code and images - Change
export NODE_BINARY=node ../node_modules/react-native/packager/react-native-xcode.shtoexport NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh
Notice how packager is now scripts, which is where that file actually lives in latest version of RN
3 Comments
To solve this problem use following steps :
- Use node version v4.2.1
- cd into [your app]/node_modules/react-native/packager
- $sh ./packager.sh (for some reason this runs fine)
- Go into XCode and go to the Build Phases tab. Remove the last item on the list (the one that runs the script). So you're left with Target Dependencies, Compile Sources, Link Binary With Libraries, and Copy Bundle Resources.
Now hit build in XCode. Since the shell script is no longer part of the XCode build routine, it shouldn't fail. And if you have the react native client server running in another terminal window, then everything should run fine.
7 Comments
I was able to solve this error by:
Opening your react native project in XCode Navigate to Build Phases > Bundle React Native code and images
Change
export NODE_BINARY=node
../node_modules/react-native/packager/react-native-xcode.sh
to
export NODE_BINARY=node
./node_modules/react-native/scripts/react-native-xcode.sh
Comments
I added source ~/.bash_profile to the top of my [project_name]/node_modules/react-native/packager/react-native-xcode.sh file and it works.


npm install -g react-native-cli? Is your global node_modules directory inPATHin the shell session?