react-native: React Codegen Command PhaseScriptExecution failed with a nonzero exit code

Description

“react”: “18.3.1”, “react-native”: “0.77.0”, “Node”: “23.3.0”

I am trying to build IOS on new project, but getting error with react codegen

I didn’t add a single line of code, pr any packages

Steps to reproduce

  1. Create React Native project “not expo”
  2. open xcode and try to export a new build

React Native Version

0.77.0

Affected Platforms

Build - MacOS, Runtime - iOS

Output of npx react-native info

(node:66368) ExperimentalWarning: CommonJS module /opt/homebrew/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /opt/homebrew/lib/node_modules/npm/node_modules/supports-color/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
info Fetching system and libraries information...
System:
  OS: macOS 15.1.1
  CPU: (12) arm64 Apple M2 Max
  Memory: 1.47 GB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.3.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.1 AI-221.6008.13.2211.9619390
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.0
    wanted: 0.77.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

IOS building "React Codegen Command PhaseScriptExecution failed with a nonzero exit code"

Reproducer

Not Available

Screenshots and Videos

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 26

Most upvoted comments

[!NOTE] Not a bug report: This issue looks like a question. We are using GitHub issues exclusively to track bugs in React Native. GitHub may not be the ideal place to ask a question, but you can try asking over on Stack Overflow, or on Reactiflux.

@Saqib92 yes, just make sure the path to your project doesn’t have any spaces that was the issue for me

def not a space issue as commented before

I had this issue, it was basically because of space in my folder name. Make sure there is no folder in your path to your project which has space in the folder name.

Eg. My folder name was untitled folder which i changed it to untitledFolder

@sarthak-d11 it’s empty project, just created using

  1. npx @react-native-community/cli@latest init Customer
  2. open ios/Customer.xcworkspace in xcode
  3. build the app

I’m getting the previous error

I had the same issue, removed the space in a parent directory of the project. Fixed it. Thanks!

I had this issue and it was because I had it in the iCloud Drive directory which had spaces in it

No, sir, I checked already @Java-S12138 No space is there

It may appear in the superior directory,such as (~/code/react native/your_project)

The issue still persists. I have verified to not find any spaces in folders of codebase