9

I have been having issues trying to create an IOS build of a react native application. Originally I made this on windows with an android emulator. Then I tried to build the react native code on mac with xcode but I can't get past this error.

I have tried a couple things like reinstalling node and unsetting the PREFIX variable in the find-node script but I have not gotten any further

When inspecting the error it says:

  • FBReactNativeSpec - Uncategorized - PhaseScriptExecution failed with a nonzero exit code

int he details there is another error that says:

  • bash: mobile/node_modules/react-native/scripts/../Libraries: No such file or directory

4 Answers 4

9

I had the same issue on my MacBook Pro with M1 chip. I managed to get rid of the FBReactNativeSpec error by editing the Project settings.

Try the following:

  1. In Xcode select your app's project and then select the target.

  2. In Terminal enter the following command to find out the path of your node installation:

which node

This should give you a path. Something like:

/Users/thomashuber/.nvm/versions/node/v16.14.0/bin/node

  1. Copy this path.

  2. In Xcode with the target selected click on Build Phases and open Bundle React Native code and images

  3. Replace NODE_BINARY=node. Instead of node enter the path that you have copied so that it is something like this NODE_BINARY=/Users/thomashuber/.nvm/versions/node/v16.14.0/bin/node

Replacing node with node path

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

1 Comment

I am on XCode 15.4 and it looks different set -e WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh" REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh" /bin/sh -c "$WITH_ENVIRONMENT $REACT_NATIVE_XCODE"
0

In my case, the following line was somehow added:

export NODE_BINARY=/opt/homebrew/bin/node

When I commented it out like this:

# export NODE_BINARY=/opt/homebrew/bin/node

the project started to work again. However, adding the direct path to Node as suggested in the accepted answer also worked for me.

Comments

-1

The Above solution works but always keep in mind that.

which node

First run this command. In my case my path of Node was different. So only paste the path which given by the "which node" command

Comments

-1

enter image description here enter image description here

i also had similar issue, same as es1 i change the config from xcode node_binary also on target FBReactNativeSpec build phase (if not available yet you can add it to your target). also refer to this link:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.