最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Xcode Build Fails - Command PhaseScriptExecution Failed Due to Missing Node Path - Xcode Version 16.2 - React Nativ

programmeradmin4浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default 0

Solution 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:

  1. 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.

发布评论

评论列表(0)

  1. 暂无评论