react-native: PhaseScriptExecution error generate-specs.sh: line 27: cd: : No such file or directory

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

Provide a detailed list of steps that reproduce the issue. I am creating a new react native project and any time i run (npx react-native run-ios --device"") i get this error i have been solving this error (using series of solution from stack overflow and gitHub issues) for 2 days now any help, I would really appreciate it.

I have tried a number of solutions from GitHub issues, no result yet, please any help to solve this would be much appreciated.

/Users/nitin/Downloads/SampleProject/ios/Pods/…/…/node_modules/react-native/React/FBReactNativeSpec/…/…/scripts/generate-specs.sh: line 27: readlink: command not found /Users/nitin/Downloads/SampleProject/ios/Pods/…/…/node_modules/react-native/React/FBReactNativeSpec/…/…/scripts/generate-specs.sh: line 27: dirname: command not found /Users/nitin/Downloads/SampleProject/ios/Pods/…/…/node_modules/react-native/React/FBReactNativeSpec/…/…/scripts/generate-specs.sh: line 27: cd: : No such file or directory

Command PhaseScriptExecution failed with a nonzero exit code

using xcode 12.5 react-native -v 0.65.1 node -v 14.17.6

React Native version:

react-native -v 0.65.1

Steps To Reproduce

I am using Apple M1 and just init a fresh project react-native init SampleProject

Expected Results

Should Compile

Snack, code example, screenshot, or link to a repository:

Screenshot 1943-06-15 at 2 58 37 PM

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 34

Most upvoted comments

@laurpantelimon I found the solution after hours of debugging you need to modify this file for now.

  1. Edit this file /node_modules/react-native/React/FBReactNativeSpec/../../scripts/generate-specs.sh
  2. Add this line export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
  3. Then run the project using Xcode it will work 100%

@hoanganh1712 This is the exact path /node_modules/react-native/scripts/generate-specs.sh or rerun the npm install and check if path exists.

There could be other ways to fix this but I did not get much time to dig deeper into the issue.

I found my file at node_modules/react-native/scripts/generate-specs.sh. Added the export the top, ran in xcode, and it worked. I have intel mac running Big Sur 11.5.1

@hoanganh1712 who is khaeransori ?

Just do simple one thing, cd ios && pod install it will work… Thanks ✌️✌️

Hey @DaneHoward, I added this script at the end of my Podfile. post_install do |installer| ## RCT-Folly fix installer.pods_project.targets.each do |target| if target.name == “RCT-Folly” target.build_configurations.each do |config| config.build_settings[‘GCC_PREPROCESSOR_DEFINITIONS’] ||= [‘$(inherited)’, ‘FOLLY_HAVE_CLOCK_GETTIME=1’] end end end end I then deleted the Podfile.lock & Pods directory from my project and run pod install command Then i upgraded all the pods min deployment target to iOS 12 and I run the project and it worked fine