upgrade-support icon indicating copy to clipboard operation
upgrade-support copied to clipboard

FBReactNativeSpec - Command PhaseScriptExecution failed with a nonzero exit code React-Native version 0.63 -> 0.64.1

Open ashish3303 opened this issue 3 years ago • 30 comments

Hi,

I have got this error when I trying to run the build using Xcode -

/Volumes/Data/Projects/ReactNativeProjects/testP/node_modules/react-native/scripts/generate-specs.sh: line 27: readlink: command not found /Volumes/Data/Projects/ReactNativeProjects/testP/node_modules/react-native/scripts/generate-specs.sh: line 27: dirname: command not found /Volumes/Data/Projects/ReactNativeProjects/testP/node_modules/react-native/scripts/generate-specs.sh: line 27: cd: : No such file or directory Command PhaseScriptExecution failed with a nonzero exit code

I tried everything as below but nothing happens -

  1. Uninstall react-native-cli
  2. Delete node_modules, package-lock.json, pods, and podfile.lock
  3. Run npm install && cd ios && npx pod-install
  4. Comment complete code of find-node.sh
  5. Install nvm
  6. rm -rf node_modules/react-native/scripts/find-node.sh && touch node_modules/react-native/scripts/find-node.sh

But still having the same issue with the build.

And when I run the react-native run-ios command in the terminal then I got this issue:

The following build commands failed: PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/prologiciosdeviosdev/Library/Developer/Xcode/DerivedData/testP-bngsipncomaqjaevntyfingdcigq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-3805B1ED96D1BF469DDC8CE1A1B7C610.sh (1 failure)

Versions

  1. react-native = 0.64
  2. Xcode = 12.5

Thanks

ashish3303 avatar May 18 '21 11:05 ashish3303

The same issue... Any ideas?

kosbog avatar May 28 '21 14:05 kosbog

Same issue there. Trying to troubleshoot it for the past 2 days, but still no luck...

Karniej avatar Aug 03 '21 21:08 Karniej

Are you using nvm? I had the same problem and as suggested at https://github.com/react-native-community/upgrade-support/issues/138#issuecomment-855462806 nvm unalias default fixed it.

There is a script that searches for the node executable to use for building things, and somehow it gets messed up or chooses an incompatible version. But still seems like a bug to me...

phlmn avatar Aug 04 '21 08:08 phlmn

Same issue, been stuck on this for days, I do not have nvm installed. Any ideas?

xcode 13, RN 64.2

mharrisweb avatar Sep 23 '21 17:09 mharrisweb

Thanks @phlmn, nvm unalias default fixed it for me also.

smalomo avatar Oct 12 '21 14:10 smalomo

Are you using nvm? I had the same problem and as suggested at #138 (comment) nvm unalias default fixed it.

There is a script that searches for the node executable to use for building things, and somehow it gets messed up or chooses an incompatible version. But still seems like a bug to me...

You saved my life... nvm unalias default fixed it.

alienriquebm avatar Jan 11 '22 23:01 alienriquebm

Thanks @phlmn, nvm unalias default fixed it for me also.

Worked for me, Thanks 😍

vimukthinuclei avatar Jan 15 '22 06:01 vimukthinuclei

Are you using nvm? I had the same problem and as suggested at #138 (comment) nvm unalias default fixed it.

There is a script that searches for the node executable to use for building things, and somehow it gets messed up or chooses an incompatible version. But still seems like a bug to me...

This worked for me as well.

nibblesnbits avatar Jan 22 '22 06:01 nibblesnbits

"nvm unalias default" did NOT fix the issue for me in Xcode 13.2. I still get: "Command PhaseScriptExecution failed with a nonzero exit code" with no other information. For reference, I followed the iOS steps here: https://reactnative.dev/docs/environment-setup

I can run the node app from within VSCode. When I launch it from a second terminal in there, it loads the simulator but doesn't actually run the app on it. When I launch it from the Xcode workspace with a clean build folder, the above error happens repeatedly.

SavedByZero avatar Jan 28 '22 16:01 SavedByZero

nvm unalias default works for me. I have ran it then re-installed pod and build app via xcode. FBReactNativeSpec problem fixed. I have other erros now but I think it relate to something else.

BruceSuperProgramer avatar Jan 31 '22 11:01 BruceSuperProgramer

Are you using nvm? I had the same problem and as suggested at #138 (comment) nvm unalias default fixed it.

There is a script that searches for the node executable to use for building things, and somehow it gets messed up or chooses an incompatible version. But still seems like a bug to me...

Great. thanks.

arshadrGit avatar Feb 01 '22 12:02 arshadrGit

Hello, volta user here. I resolve this issue by exporting NODE_BINARY in every script that execute node, in my case I define it in FBReactNativeSpec and Build Phase for Bundle React Native code and images

Screen Shot 2022-02-11 at 16 20 10 Screen Shot 2022-02-11 at 16 24 19

adeyahya avatar Feb 11 '22 09:02 adeyahya

Hello, volta user here. I resolve this issue by exporting NODE_BINARY in every script that execute node, in my case I define it in FBReactNativeSpec and Build Phase for Bundle React Native code and images

Screen Shot 2022-02-11 at 16 20 10 Screen Shot 2022-02-11 at 16 24 19

@adeyahya it works for me. Thanks!

ccyfly avatar Feb 21 '22 08:02 ccyfly

I lost half a day trying to solve this. I have no idea why this started happening all of a sudden for a specific project while other projects run, but in my case I had to run this:

nvm alias default 14.17.0

aliustaoglu avatar Feb 24 '22 00:02 aliustaoglu

Remove nvm worked for me.

wleenavo avatar Mar 03 '22 08:03 wleenavo

I had to remove nvm because I'm not using nvm as my node manager. So I had to brew uninstall nvm and it worked.

angelroma avatar Mar 07 '22 02:03 angelroma

I am not using nvm and was running into the same error. Deleting the piece of code that looks for nvm find-node.sh in node-modules/react-native/scripts solved this issue for me

donalbertico avatar Mar 07 '22 13:03 donalbertico

I found @donalbertico 's advice worked for me.

I see the PR with the latest changes to find-node.sh was merged & released in RN v0.67.2 ~so downgrading to v0.67.1 should allow everything to run again without manual file edits.~

Edit: I tried RN v0.67.1 with the old version of the file & still found that step was failing. (The problem is once you get a successful build you need to clean your build folder to test other configurations or it will just succeed.)

LordParsley avatar Mar 16 '22 15:03 LordParsley

For me it was just having a space in folder name which was in the path of project folder from root.

fariskhan563 avatar May 17 '22 09:05 fariskhan563

I also got this error none of the above sol solve it React Native 0.68.2 (also try other versions too) xcode 13.2.1

me-ibad avatar May 20 '22 00:05 me-ibad

Hello, volta user here. I resolve this issue by exporting NODE_BINARY in every script that execute node, in my case I define it in FBReactNativeSpec and Build Phase for Bundle React Native code and images Screen Shot 2022-02-11 at 16 20 10 Screen Shot 2022-02-11 at 16 24 19

@adeyahya it works for me. Thanks!

I'm confused about this solution - doesn't this involve manually changing a script that's generated in the Pods?

In my case, the build is failing on CI (CircleCI via fastlane), so how would I manually override a Pod script?

matt-dalton avatar Oct 29 '22 17:10 matt-dalton

my solution was delete nvm via brew brew uninstall nvm

bluefqcebaby avatar Oct 31 '22 11:10 bluefqcebaby

After trying all this with no success, upgrading to RN 0.70.5 and fixing all build errors after that fixed the issue and compiled successfully.

zive-arildo avatar Nov 10 '22 04:11 zive-arildo

Uninstall nvm was my solution.

Just remove the folder, usually ~/.nvm

nicolascavallin avatar Nov 23 '22 14:11 nicolascavallin

So at this point are we to understand that:

  • There's (possibly) a fix in 0.70.x
  • Until then, your only option is basically to not use nvm ?

matt-dalton avatar Nov 23 '22 19:11 matt-dalton

I had to comment out content of find_node function inside FBReactNativeSpec [CP-User] Generate Specs script and manually set NODE_BINARY variable inside same function.

P.S. I am using nvm

AnuragTiwari1 avatar Dec 06 '22 13:12 AnuragTiwari1

@AnuragTiwari1 I can't find any find_node function in my code.

vinay-blueehr avatar Dec 21 '22 06:12 vinay-blueehr

For me it was just having a space in folder name which was in the path of project folder from root.

That did it for me!

raduvarga avatar Mar 16 '23 22:03 raduvarga

may be unrelated but this also fails on ionic+angular+capacitor build via fastlane on iOS. Fix is to search/replace all readlink xxx to readlink -f xxx in the Pods/…/Pods-App-frameworks file, but I have to do that pretty often.

I don't know enough to tell if this is caused by fastlane, angular, XCode, Pods or something else :thinking: but it IS reverted after npx cap sync ios and that runs pod install in the ios/App directory - THAT is what rewrites the files back to only "readlink" with no -f :thinking:

Wonder if that would point to Pods as the source for this?

arnotixe avatar Apr 28 '23 04:04 arnotixe

For me it was just having a space in folder name which was in the path of project folder from root.

OMG. This fixed the issue I am facing for days already!!!! THANK YOU SO MUCH!

webdevpro129 avatar Sep 12 '23 05:09 webdevpro129