skip to Main Content

I’m getting the following error in Xcode when building

Node found at: /opt/homebrew/bin/node
/Users/adamwright/Documents/Development/AB3MobileUpgrade/AB3MobileUpgrade/ios/Pods/../../node_modules/react-native/React/FBReactNativeSpec/../../scripts/react_native_pods_utils/script_phases.sh: line 34: /opt/homebrew/bin/node: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

It looks like my node is in the wrong path. if i do type node i get
node is /usr/local/bin/node

I tested on another machine also using homebrew and that path is opt/homebrew/bin/node where homebrew has installed it and the app builds!

How do I update the path to the homebrew default location so it’s correct?

2

Answers


  1. Chosen as BEST ANSWER

    in the ios folder is an .env file

    The path in that just needed updating, it is an autogenerated file but i guess it screwed up.

    export NODE_BINARY=/usr/local/bin/node
    

  2. The main issue was installing NodeJs by using homebrew, it would lose the main path of the NodeJs folder. This solution is a project’s local solution and maybe for another project which needs NodeJs, it would encounter the same issue.

    • Global solution: Add the NODE_BINARY to your .zshrc or .bashrc file as a global environment variable and concat the /usr/local/bin/node to your PATH system.
    • Permanent solution: Remove the homebrew NodeJs and install nvm and then by using nvm install any NodeJs versions you want

    With the permanent solution you won’t encounter any issues ever

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search