react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Command PhaseScriptExecution failed with a nonzero exit code with ios build

Open AwsBTek opened this issue 9 months ago • 4 comments

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

Steps to reproduce

  1. Yarn.
  2. cd ios.
  3. pod install -> pods installed successfully.
  4. open xcode project.
  5. Product -> build.
  6. image

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

AwsBTek avatar May 10 '24 18:05 AwsBTek

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.

Uploading Screenshot 2024-05-11 at 11.47.14 AM.png…

Siliconvelly avatar May 11 '24 06:05 Siliconvelly

check Your Mac storage

MUSHTHAK2899 avatar May 11 '24 15:05 MUSHTHAK2899

@MUSHTHAK2899 My Macbook's storage is 415 GB free.

AwsBTek avatar May 11 '24 16:05 AwsBTek

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"

sandipsarkar13 avatar May 11 '24 17:05 sandipsarkar13

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 avatar May 14 '24 22:05 baenacoco

@baenacoco Many thanks; I was able to solve the problem with your help.

AwsBTek avatar May 15 '24 06:05 AwsBTek

Same issue react native 0.74.2 when archive.

image

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.

mMarcos208 avatar Jun 12 '24 19:06 mMarcos208