11

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.

3
  • Have you installed the React Native CLI with npm install -g react-native-cli? Is your global node_modules directory in PATH in the shell session? Commented Nov 11, 2015 at 16:58
  • Same issue here. Using oh my zsh for path setup. Running which react-native shows: /Users/kevin/.node/bin/ Added that to both bash_profile and zsh profile. Any ideas? Is it possible to add this to the xcode project directly? Or is there a way to pull as a local dep from the project folder? Commented Nov 11, 2015 at 19:22
  • have a look here github.com/facebook/react-native/issues/…, I solved this by symlinking node/react-native binaries to /bin/ Commented Nov 12, 2015 at 2:09

5 Answers 5

42

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.sh to export 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

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

This fixed it for us, thanks! For those trying to find this via web search, my exact error message was: Script-00DD1BFF1BD5951E006B06BC.sh: line 3: ../node_modules/react-native/packager/react-native-xcode.sh: No such file or directory ** BUILD FAILED **
This fixed for me. Should be choose as the best answer.
You saved my time. i didn't fix a couple days
4

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

Hi, could please explain in more detail what the "Build Phases tab" is? Cheers.
There are 7 options in center section of Xcode -> General, Capabilities, Resource Tags, Info, Build Settings, Build Phases and Build Rules. Choose Build phases and proceed :)
I can confirm that this works. Just make sure you run the packager.sh every time you work.
there is no packager in my react-native folder
@Pikachu-go I see in RN0.46 those things are moved to scripts folder
|
2

Simply change

../node_modules/react-native/packager/react-native-xcode.sh

to

../node_modules/react-native/scripts/react-native-xcode.sh

at

Xcode -> Select your Project -> "Build Phases" tab -> "Bundle React Native code and images"

Comments

1

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

In Latest versions packager is replaced by scripts

Comments

0

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.

See https://github.com/facebook/react-native/issues/3948

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.