React Native iOS Build Fails: Missing Node.js Binary in script_phases.sh
Exact Error:
/Users/admin2/Desktop/Projects/ios/Pods/../../node_modules/react-native/React/FBReactNativeSpec/../../scripts/react_native_pods_utils/script_phases.sh: line 83: /Users/.nvm/versions/node/v16.20.2/bin/node: No such file or directory
Environment:
React Native Version: 0.69.3
Node.js Version: 22.7.0
Xcode Version: 16.2
What I've Tried:
Updating the Node.js Path in Xcode: Set export NODE_BINARY=$(which node) in the build script.
Reinstalled Dependencies:
rm -rf node_modules
yarn install
cd ios
pod install
To resolve the issue caused by an incorrect or outdated NODE_BINARY path in your iOS project.
Follow these steps:-
First, navigate to the ios folder in your project by running cd ios in the terminal. Then, on macOS, press Command + Shift + .
to reveal hidden files in Finder.
Look for the xcode.env
and xcode.env.local
files in the folder and delete them.
Next, clean the build folder by running xcodebuild clean in the terminal, or alternatively, open the project in Xcode and choose Product > Clean Build Folder or press Shift + Command + K
.
Finally, rebuild the project by running npx react-native run-ios
to generate a fresh build.
This should fix the problem and restore your project’s functionality.