Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running first init project Error React-rncore: Command PhaseScriptExecution failed with a nonzero exit code #39734

Open
fachrinfl opened this issue Oct 1, 2023 · 95 comments
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Triage 🔍

Comments

@fachrinfl
Copy link

fachrinfl commented Oct 1, 2023

Description

I'm just trying to run a newly initialized React Native project.

React Native Version

0.72.5

Output of npx react-native info

System:
OS: macOS 14.0
CPU: (8) arm64 Apple M2
Memory: 129.89 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.12.1
path: ~/.nvm/versions/node/v18.12.1/bin/node
Yarn: Not Found
npm:
version: 8.19.2
path: ~/.nvm/versions/node/v18.12.1/bin/npm
Watchman:
version: 2023.09.18.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.13.0
path: /Users/fachrinfl/.rvm/gems/ruby-2.7.7/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.0
- iOS 17.0
- macOS 14.0
- tvOS 17.0
- watchOS 10.0
Android SDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.9971841
Xcode:
version: 15.0/15A240d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.19
path: /opt/homebrew/opt/openjdk@11/bin/javac
Ruby:
version: 2.7.7
path: /Users/fachrinfl/.rvm/rubies/ruby-2.7.7/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.5
wanted: 0.72.5
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Steps to reproduce

npx react-native init AwesomeProject
xed -b ios
Running via XCode

Snack, screenshot, or link to a repository

Screenshot 2023-10-01 at 16 53 46
@github-actions github-actions bot added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Oct 1, 2023
@github-actions
Copy link

github-actions bot commented Oct 1, 2023

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@cortinico
Copy link
Contributor

We can't help you further with more logs sadly @fachrinfl

@marcogravbrot
Copy link

marcogravbrot commented Oct 2, 2023

Exact same issue here, using Xcode 15 (public version not beta) on macOS Sonoma. Tried both on 0.72.5 and 0.72.4. Also on an M2 chip.

Building and running the app still works fine with "react-native start" and fastlane, but when trying to build through Xcode this error keeps occurring after the update to Sonoma

System:
  OS: macOS 14.0
  CPU: (8) arm64 Apple M2
  Memory: 60.28 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.5.1
    path: /opt/homebrew/bin/node
  Yarn: Not Found
  npm:
    version: 10.1.0
    path: /opt/homebrew/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.13.0
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.0/15A240d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.8
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /opt/homebrew/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

@FawadMahmood
Copy link

I am facing same issues.

@marcogravbrot
Copy link

marcogravbrot commented Oct 3, 2023

Fixed this issue for now by deleting Xcode 15 public release and downloading Xcode 15 beta 8. (Also updated macOS to 14.1 developer beta but unsure if that had any effect)

@FawadMahmood
Copy link

FawadMahmood commented Oct 3, 2023

@cortinico, here are some more logs:

Showing Recent Messages
Node found at: /usr/local/bin/node

internal/modules/cjs/loader.js:1131

      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);

      ^



Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/fawadmahmood/Documents/latest-mobile-fax/node_modules/wrap-ansi/index.js

require() of ES modules is not supported.

require() of /Users/fawadmahmood/Documents/latest-mobile-fax/node_modules/wrap-ansi/index.js from /Users/fawadmahmood/Documents/latest-mobile-fax/node_modules/cliui/build/index.cjs is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.

Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/fawadmahmood/Documents/latest-mobile-fax/node_modules/wrap-ansi/package.json.



    at new NodeError (internal/errors.js:322:7)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1131:13)

    at Module.load (internal/modules/cjs/loader.js:979:32)

    at Function.Module._load (internal/modules/cjs/loader.js:819:12)

    at Module.require (internal/modules/cjs/loader.js:1003:19)

    at require (internal/modules/cjs/helpers.js:107:18)

    at Object.<anonymous> (/Users/fawadmahmood/Documents/latest-mobile-fax/node_modules/cliui/build/index.cjs:293:14)

    at Module._compile (internal/modules/cjs/loader.js:1114:14)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)

    at Module.load (internal/modules/cjs/loader.js:979:32) {

  code: 'ERR_REQUIRE_ESM'

}

@soutua
Copy link

soutua commented Oct 5, 2023

I encountered a similar issue on an existing project after I run brew upgrade on my mac, which updated Node version from 18.17.0 to 18.18.0. In the end the issue was that the ios/.xcode.env.local file that gets generated the first time you run pod install, had a hard coded path to the 18.17.0 Node version, which didn't exist anymore. So fixing that file fixed the build. This doesn't however explain why you would have this issue on a new project, but probably good idea to check what that file contains 🤔

@fachrinfl
Copy link
Author

i cant still run the project @soutua after upgrading node version.

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Oct 5, 2023
@gomestai
Copy link

Same error, fresh project, xcode 15, xcode 15 beta 8 both giving same error

@gomestai
Copy link

Solved. In my case, the problem occurred if the parent folder names contained whitespaces. Removing whitespaces in folder names fixed the problem

@shaunsheeps
Copy link

Same thing here. I solved my issue by removing a whitespace in one of the parent folders

@ricodidan
Copy link

Same with me, any update please?

@Rajnish1211
Copy link

Rajnish1211 commented Nov 2, 2023

Same error with me (Mac version : 14.1 , Xcode : 15.0.1 and node : 18.18.0 )

Any Update ?

@Rajnish1211
Copy link

Rajnish1211 commented Nov 2, 2023

Solved. In my case, the problem occurred if the parent folder names contained whitespaces. Removing whitespaces in folder names fixed the problem

Its also work for me
https://www.positioniseverything.net/command-phasescriptexecution-failed-with-a-nonzero-exit-code/
Thanks @gomestai

@DiorAbjalilov
Copy link

Me too this error

@gokul1099
Copy link

I am also facing the same issue. after running react-native run-ios it is showing PhaseScriptExecution failed with lots of error. If i scroll up to the top in the terminal I could see something like
find: /Users/{user}/Library/Developer/Xcode/DerivedData/{projectname}-aaljqomuvoszdacrlntaoafplcyl/SourcePackages/artifacts: No such file or directory
/bin/sh: : No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

@ricodidan
Copy link

ricodidan commented Nov 6, 2023

In my case just solved by

  1. Deleting package-lock.json
  2. Deleting yarn.lock
  3. Deleting node_modules & Pods from ios folder
  4. Installing node_modules again.
  5. Adding Pods again, ie. npx pod-install
  6. Then running project by - npx react-native run-ios

hopefully worked

@DiorAbjalilov
Copy link

Description

I'm just trying to run a newly initialized React Native project.

React Native Version

0.72.5

Output of npx react-native info

System: OS: macOS 14.0 CPU: (8) arm64 Apple M2 Memory: 129.89 MB / 8.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.12.1 path: ~/.nvm/versions/node/v18.12.1/bin/node Yarn: Not Found npm: version: 8.19.2 path: ~/.nvm/versions/node/v18.12.1/bin/npm Watchman: version: 2023.09.18.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.13.0 path: /Users/fachrinfl/.rvm/gems/ruby-2.7.7/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.9971841 Xcode: version: 15.0/15A240d path: /usr/bin/xcodebuild Languages: Java: version: 11.0.19 path: /opt/homebrew/opt/openjdk@11/bin/javac Ruby: version: 2.7.7 path: /Users/fachrinfl/.rvm/rubies/ruby-2.7.7/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.5 wanted: 0.72.5 react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false

Steps to reproduce

npx react-native init AwesomeProject xed -b ios Running via XCode

Snack, screenshot, or link to a repository

Screenshot 2023-10-01 at 16 53 46

me too has this error

@DiorAbjalilov
Copy link

Description

I'm just trying to run a newly initialized React Native project.

React Native Version

0.72.5

Output of npx react-native info

System: OS: macOS 14.0 CPU: (8) arm64 Apple M2 Memory: 129.89 MB / 8.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.12.1 path: ~/.nvm/versions/node/v18.12.1/bin/node Yarn: Not Found npm: version: 8.19.2 path: ~/.nvm/versions/node/v18.12.1/bin/npm Watchman: version: 2023.09.18.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.13.0 path: /Users/fachrinfl/.rvm/gems/ruby-2.7.7/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.9971841 Xcode: version: 15.0/15A240d path: /usr/bin/xcodebuild Languages: Java: version: 11.0.19 path: /opt/homebrew/opt/openjdk@11/bin/javac Ruby: version: 2.7.7 path: /Users/fachrinfl/.rvm/rubies/ruby-2.7.7/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.5 wanted: 0.72.5 react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false

Steps to reproduce

npx react-native init AwesomeProject xed -b ios Running via XCode

Snack, screenshot, or link to a repository

Screenshot 2023-10-01 at 16 53 46

solution.
There should be no empty space in the names of folders managing the project. and worked for me

@DiorAbjalilov
Copy link

I am also facing the same issue. after running react-native run-ios it is showing PhaseScriptExecution failed with lots of error. If i scroll up to the top in the terminal I could see something like find: /Users/{user}/Library/Developer/Xcode/DerivedData/{projectname}-aaljqomuvoszdacrlntaoafplcyl/SourcePackages/artifacts: No such file or directory /bin/sh: : No such file or directory Command PhaseScriptExecution failed with a nonzero exit code

Thanks 👍

@FedeRobledo
Copy link

Same issue here with Xcode 15.0.1 on macOS Sonoma.

In my case i solved it setting the correct path to the nodejs version that my project needs, i don't know why but xcode was using another.

To do it i had to create the file .xcode.env.local inside my ios folder and set the next path NODE_BINARY="/opt/homebrew/Cellar/node@16/16.20.2/bin/node"

@mykappevolve
Copy link

facing the same issue on mac 13.6.1, xcode 15.0.1

@Edison4mobile
Copy link

same for me.

@Katerlad
Copy link

Removing folder with white spaces fixed the problem for me as well. Why in the world. Does anyone know why this may be the case? This means XCode cannot handle white space folders currently?

@alextkd
Copy link

alextkd commented Nov 20, 2023

Removing folder with white spaces fixed the problem for me as well. Why in the world. Does anyone know why this may be the case? This means XCode cannot handle white space folders currently?

I still have this problem and there are no white spaces in the name of the parent folder so it's not really that.

@swathycsv
Copy link

@miteshdevg
Actually my input files and outfiles are empty. But i have contents in input files list and output file lists.

@miteshdevg
Copy link

miteshdevg commented Feb 26, 2024

@miteshdevg Actually my input files and outfiles are empty. But i have contents in input files list and output file lists.

i have resolved it,
could you please send me a pic of issue ,
Please send me ASAP,

@swathycsv
Copy link

![issue](https://github.co@miteshdevg ook/react-native/assets/68094016/efd93df6-8584-420d-a201-ed561d3ad7b7)
@Mitesh

@miteshdevg
Copy link

![issue](https://github.co@miteshdevg ook/react-native/assets/68094016/efd93df6-8584-420d-a201-ed561d3ad7b7) @Mitesh

i can't see image bro
@swathycsv
Please drag and drop image

@miteshdevg
Copy link

![issue](https://github.co@miteshdevg ook/react-native/assets/68094016/efd93df6-8584-420d-a201-ed561d3ad7b7) @Mitesh

i can't see image please drag and drop your image

@swathycsv
Copy link

swathycsv commented Feb 26, 2024

@miteshdevg issue

@miteshdevg
Copy link

@miteshdevg issue

bro send a pic of error not like this

@miteshdevg
Copy link

miteshdevg commented Feb 26, 2024

271820838-378308fd-25b8-4d34-a7b8-70532020eaf1

are you facing this error ?
@swathycsv

@swathycsv
Copy link

Screenshot 2024-02-26 at 4 31 56 PM

@miteshdevg

@miteshdevg
Copy link

Bro
Please do one think

@miteshdevg
Copy link

Screenshot 2024-02-26 at 4 39 14 PM

and

Screenshot 2024-02-26 at 4 39 39 PM

@miteshdevg
Copy link

@swathycsv please info me so i remove that pics

@swathycsv
Copy link

Screenshot 2024-02-26 at 4 44 32 PM

@miteshdevg

@miteshdevg
Copy link

Okay that's means already there ?

@miteshdevg
Copy link

export NODE_BINARY="/opt/homebrew/opt/node@20/bin/node"

Please do like this
inside double invertor coma,

@miteshdevg
Copy link

@swathycsv what's status bro
have you resolve issue ?

@swathycsv
Copy link

@miteshdevg same error bro

@miteshdevg
Copy link

@miteshdevg same error bro

Please ask to any your friend who is IOS developer ,

@Pouria22
Copy link

React native version
0.73.5

Edit the node_modules/react-native/scripts/react-native-xcode.sh file

change the first entry "set -x -e" to "set -x"
save and rebuild.

I hope it was useful.

@AlexeyIS
Copy link

AlexeyIS commented Mar 4, 2024

Had the same issue, fixed by setting the export NODE_BINARY="/opt/homebrew/bin/node" in .xcode.env.local

Path /opt/homebrew/bin/node is coming from which node command

@anton-patrushev
Copy link

I was able to fix by creating .xcode.env.local file (ignored by git)

and following steps from here in order to add real path to node binary

@hyry2024
Copy link

hyry2024 commented Apr 8, 2024

Had the same issue, fixed by setting the export NODE_BINARY="/opt/homebrew/bin/node" in .xcode.env.local

Path /opt/homebrew/bin/node is coming from which node command

Maybe good to know, I had the same path without the double routes (") after adding the " before and after it worked.

@NewvilleMedia
Copy link

I encountered a similar issue on an existing project after I run brew upgrade on my mac, which updated Node version from 18.17.0 to 18.18.0. In the end the issue was that the ios/.xcode.env.local file that gets generated the first time you run pod install, had a hard coded path to the 18.17.0 Node version, which didn't exist anymore. So fixing that file fixed the build. This doesn't however explain why you would have this issue on a new project, but probably good idea to check what that file contains 🤔

this works

@Hamadahmad000
Copy link

Hamadahmad000 commented Jun 10, 2024

The issue is because of space within folder name where i have created project and running it i just removed space from folder name and i added (-) dash its worked for me

@miteshdevg
Copy link

The issue is because of space within folder name where i have created project and running it i just removed space from folder name and i added (-) dash its worked for me

Yaa your right we need to remove space from folder name so for resolve issue

@malyshkoserhii
Copy link

I encountered a similar issue on an existing project after I run brew upgrade on my mac, which updated Node version from 18.17.0 to 18.18.0. In the end the issue was that the ios/.xcode.env.local file that gets generated the first time you run pod install, had a hard coded path to the 18.17.0 Node version, which didn't exist anymore. So fixing that file fixed the build. This doesn't however explain why you would have this issue on a new project, but probably good idea to check what that file contains 🤔

Thank you! This advice helped me to fix this issue. (my Xcode version 15.4, react-native 0.73.8)

@sLurPPPeRsTaR
Copy link

image

its weird i also having same issue so i try to replace with picture above, hopefuly help, bless you all

@FilipSavic95
Copy link

Parent folder had "&" . . .
thanks to @gomestai who had a whitespace in his parent folder name, I thought any "funny" chars could cause an issue :D

@petrichor-hl
Copy link

In my case just solved by

  1. Deleting package-lock.json
  2. Deleting yarn.lock
  3. Deleting node_modules & Pods from ios folder
  4. Installing node_modules again.
  5. Adding Pods again, ie. npx pod-install
  6. Then running project by - npx react-native run-ios

hopefully worked

Takes a lot of time,
But that's work for me!
Thanks

@kristalpithwa
Copy link

React native version 0.73.5

Edit the node_modules/react-native/scripts/react-native-xcode.sh file

change the first entry "set -x -e" to "set -x" save and rebuild.

I hope it was useful.

Thank you so much it's work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Triage 🔍
Projects
None yet
Development

No branches or pull requests