Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Xcode cannot find node when building a React Native iOS app

ErrorCan't find node

Short answer

Xcode runs the React Native bundle script without your terminal's PATH, so it needs a path to node. The script reads NODE_BINARY from ios/.xcode.env, then ios/.xcode.env.local. Put export NODE_BINARY=$(command -v node) in one of them, or load nvm from ~/.zshenv, then clean and build again.

  • Applies to React Native 0.8x, Node.js 22.11+, Xcode 26, macOS
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the node path your terminal uses, and see what the project file says. The build log line 'Node found at:' shows which path Xcode actually got.

    command -v node
    cat ios/.xcode.env
    cat ios/.xcode.env.local
  2. 2Match what you see, then jump to its fix

    1. 1[Warning] You need to configure your node path in the ".xcode.env" file environmentNODE_BINARY is not set for XcodeFix
    2. 2No such file or directory for a node path that you or a teammate typed into .xcode.env or .xcode.env.localA hard-coded node path went stale after a Node upgradeFix
    3. 3command -v node works in Terminal but the Xcode build cannot find itnode comes from nvm and zsh does not load it for XcodeFix
    4. 4Terminal builds work and the Xcode build phase fails right at the startA build phase script does not use zshFix

What does the error look like?

  • Can't find node
  • [Warning] You need to configure your node path in the ".xcode.env" file environment.

Cause 1 of 4

NODE_BINARY is not set for Xcode

1Check

The script starts with NODE_BINARY=$(command -v node) using Xcode's own PATH. If that finds nothing and .xcode.env does not set it, the script prints the warning and falls back to an old lookup that is marked for removal.

ls -a ios | grep xcode.env

2Fix

Create ios/.xcode.env with the node path from your terminal. Use command -v node, not a typed path, so the line also works on another machine.

cd ios
echo 'export NODE_BINARY=$(command -v node)' > .xcode.env

3Verify

Clean the build folder in Xcode (Product > Clean Build Folder) and build again. The build log shows 'Node found at:' followed by a path.

# In the Xcode report navigator, open the 'Bundle React Native code and images' step and look for: Node found at:

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 4

A hard-coded node path went stale after a Node upgrade

1Check

Both files are sourced after the default lookup, and .xcode.env.local is sourced last, so a fixed path in either file wins over the real one. Check that the path in those files still exists.

grep NODE_BINARY ios/.xcode.env ios/.xcode.env.local
ls -l "$(command -v node)"

2Fix

Replace the typed path with the command -v form, or remove the stale line from .xcode.env.local.

# ios/.xcode.env.local
export NODE_BINARY=$(command -v node)

3Verify

Build again and read the 'Node found at:' line in the log.

# Xcode report navigator > Bundle React Native code and images

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 3 of 4

node comes from nvm and zsh does not load it for Xcode

1Check

The React Native setup guide says that with nvm and zsh, Xcode needs the nvm lines in ~/.zshenv. Look at where they are now.

grep -n nvm ~/.zshrc ~/.zshenv 2>/dev/null

2Fix

Move the nvm initialisation from ~/.zshrc to ~/.zshenv.

# ~/.zshenv
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

3Verify

Quit Xcode fully, open it again, clean the build folder and build.

grep -n nvm ~/.zshenv

Confirmed by reactnative.dev

Did this fix it?

Cause 4 of 4

A build phase script does not use zsh

1Check

In Xcode, open the app target, then Build Phases, and read the Shell field of every Run Script phase.

grep -n 'shellPath' ios/*.xcodeproj/project.pbxproj

2Fix

The setup guide asks for /bin/zsh as the shell of every shell script build phase. Change any phase that uses another shell.

# Xcode > target > Build Phases > Run Script > Shell: /bin/zsh

3Verify

Build again.

grep -n 'shellPath' ios/*.xcodeproj/project.pbxproj

Confirmed by reactnative.dev

Did this fix it?

How do I stop it coming back?

  • Keep export NODE_BINARY=$(command -v node) in ios/.xcode.env and commit it; use ios/.xcode.env.local only for a machine-specific override.
  • Do not type a version-specific node path into either file; it breaks at the next Node upgrade.
  • Use Node 22.11.0 or newer, the minimum the React Native setup guide lists.
  • On CI, install Node in the job before the Xcode step.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.