react-native
react-native copied to clipboard
Command PhaseScriptExecution failed with a nonzero exit code with ios build
Description
When I tried to build the iOS project, I faced this issue:
/Users/pc/Downloads/einvoicing-react-native-mobile-app-1/ios/Pods/../../node_modules/react-native/React/FBReactNativeSpec/../../scripts/react_native_pods_utils/script_phases.sh: line 86: /usr/local/bin/node : No such file or directory Command PhaseScriptExecution failed with a nonzero exit code.
My react version: "react-native": "0.70.5",
The script_phases line: 86 is:
Steps to reproduce
- Yarn.
-
cd ios
. -
pod install
-> pods installed successfully. - open xcode project.
- Product -> build.
-
React Native Version
0.75.0
Affected Platforms
Runtime - iOS
Output of npx react-native info
System:
OS: macOS 14.4.1
CPU: (8) arm64 Apple M2
Memory: 120.72 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.15.2 - /Users/awshakam/.gem/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
Android SDK: Not Found
IDEs:
Android Studio: 2023.2 AI-232.10300.40.2321.11668458
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found.
Stacktrace or Logs
/Users/pc/Downloads/einvoicing-react-native-mobile-app-1/ios/Pods/../.xcode.env: line 5:
: command not found
Node found at: /usr/local/bin/node
/Users/pc/Downloads/einvoicing-react-native-mobile-app-1/ios/Pods/../../node_modules/react-native/React/FBReactNativeSpec/../../scripts/react_native_pods_utils/script_phases.sh: line 87: /usr/local/bin/node
: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
Reproducer
https://github.com/AwsBTek/react_native_issue
Screenshots and Videos
No response
Facing same issue on my side i am integrated new latest version of react native 0.74.1 on android side it is running but on ios side it gives error like your (@AwsBTek) mentioned.
check Your Mac storage
@MUSHTHAK2899 My Macbook's storage is 415 GB free.
I'm facing the following error on the latest version of react native 0.74.1 (Xcode 15.3) ~/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/hermes-engine.build/Script-46EB2E00030580.sh: line 2: /scripts/xcode/with-environment.sh: No such file or directory Command PhaseScriptExecution failed with a nonzero exit code
The contents of Script-46EB2E00030580.sh #!/bin/sh . "$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"
CONFIG="Release"
if echo $GCC_PREPROCESSOR_DEFINITIONS | grep -q "DEBUG=1"; then
CONFIG="Debug"
fi
"$NODE_BINARY" "$REACT_NATIVE_PATH/sdks/hermes-engine/utils/replace_hermes_version.js" -c "$CONFIG" -r "0.74.1" -p "$PODS_ROOT"
I got the error,
ios/.xcode.env => In this file you will found the instructions to set up NODE_BINARY that is necessary for building the project. I tried to set up in my .zhsrc file but it didn´t work because it have to be set up in this file. So my solution is: Create or modify a file "ios/.xcode.env.local" with this content "export NODE_BINARY=$(which node)" so you can replace "$(which node)" for your local bin node.
@baenacoco Many thanks; I was able to solve the problem with your help.
Same issue react native 0.74.2 when archive.
I verify my .xcode.env and I see
export NODE_BINARY=$(command -v node)
running in my terminal usr/local/bin/node
Welcome to Node.js v20.10.0. Type ".help" for more information.
In my .xcode.env.local
export NODE_BINARY=/usr/local/bin/node
change to export NODE_BINARY=$(command -v node)
and not working.