react-native-community / upgrade-support

A central community-backed place to request and give help when upgrading your app.
MIT License
261 stars 2 forks source link

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

Open ashish3303 opened 3 years ago

ashish3303 commented 3 years ago

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

kosbog commented 3 years ago

The same issue... Any ideas?

Karniej commented 3 years ago

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

phlmn commented 3 years ago

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...

mharrisweb commented 3 years ago

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

xcode 13, RN 64.2

smalomo commented 3 years ago

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

alienriquebm commented 2 years ago

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.

vimukthinuclei commented 2 years ago

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

Worked for me, Thanks 😍

nibblesnbits commented 2 years ago

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.

SavedByZero commented 2 years ago

"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.

BruceSuperProgramer commented 2 years ago

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.

arshadrGit commented 2 years ago

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.

adeyahya commented 2 years ago

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
ccyfly commented 2 years ago

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!

aliustaoglu commented 2 years ago

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
wleenavo commented 2 years ago

Remove nvm worked for me.

angelroma commented 2 years ago

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.

donalbertico commented 2 years ago

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

LordParsley commented 2 years ago

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.)

fariskhan563 commented 2 years ago

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

me-ibad commented 2 years ago

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

matt-dalton commented 2 years ago

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?

bluefqcebaby commented 2 years ago

my solution was delete nvm via brew brew uninstall nvm

zive-arildo commented 2 years ago

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.

nicolascavallin commented 2 years ago

Uninstall nvm was my solution.

Just remove the folder, usually ~/.nvm

matt-dalton commented 2 years ago

So at this point are we to understand that:

AnuragTiwari1 commented 1 year ago

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

vinay-blueehr commented 1 year ago

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

raduvarga commented 1 year ago

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!

arnotixe commented 1 year ago

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?

webdevpro129 commented 1 year ago

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!