I am working on a React Native project and encountering the following build error when trying to run my app on iOS using Xcode:
Node found at: /opt/homebrew/Cellar/node/22.6.0/bin/node
/Users/kiranjadhav/Library/Developer/Xcode/DerivedData/PivotalApp-fhfpmifbxjcwrmcuwtusqwdxiyas/Build/Intermediates.noindex/Pods.build/DebugStg-iphonesimulator/hermes-engine.build/Script-46EB2E00028700.sh: line 9: /opt/homebrew/Cellar/node/22.6.0/bin/node: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
I am working on a React Native project and encountering the following build error when trying to run my app on iOS using Xcode:
Node found at: /opt/homebrew/Cellar/node/22.6.0/bin/node
/Users/kiranjadhav/Library/Developer/Xcode/DerivedData/PivotalApp-fhfpmifbxjcwrmcuwtusqwdxiyas/Build/Intermediates.noindex/Pods.build/DebugStg-iphonesimulator/hermes-engine.build/Script-46EB2E00028700.sh: line 9: /opt/homebrew/Cellar/node/22.6.0/bin/node: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
Share
Improve this question
asked Mar 26 at 17:51
Kiran JadhavKiran Jadhav
3,32728 silver badges29 bronze badges
1 Answer
Reset to default 0Solution That Worked for Me:
The problem was caused by a stale .xcode.env.local
file that pointed to a removed Node.js version.
Steps to Fix:
- Delete the
.xcode.env.local
file:
rm ~/.xcode.env.local
2 . Reinstall dependencies and clean the project:
cd ios
rm -rf Pods Podfile.lock
pod install
cd ..
3. Clean and rebuild the project:
npx react-native run-ios
Why This Works:
.xcode.env.local
stores environment variables and can contain outdated paths for Node.js after an upgrade.Deleting it allows Xcode to use the correct Node.js path.