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

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

Open
ashish3303 opened this issue May 18, 2021 · 30 comments

Comments

@ashish3303
Copy link

ashish3303 commented May 18, 2021

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 ashish3303 changed the title FBReactNativeSpec - Command PhaseScriptExecution failed with a nonzero exit code FBReactNativeSpec - Command PhaseScriptExecution failed with a nonzero exit code React-Native version 0.63 -> 0.64 May 19, 2021
@ashish3303 ashish3303 changed the title FBReactNativeSpec - Command PhaseScriptExecution failed with a nonzero exit code React-Native version 0.63 -> 0.64 FBReactNativeSpec - Command PhaseScriptExecution failed with a nonzero exit code React-Native version 0.63 -> 0.64.1 May 19, 2021
@kosbog
Copy link

kosbog commented May 28, 2021

The same issue... Any ideas?

@Karniej
Copy link

Karniej commented Aug 3, 2021

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

@phlmn
Copy link

phlmn commented Aug 4, 2021

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

@mharrisweb
Copy link

mharrisweb commented Sep 23, 2021

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

xcode 13, RN 64.2

@smalomo
Copy link

smalomo commented Oct 12, 2021

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

@alienriquebm
Copy link

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
Copy link

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

Worked for me, Thanks 😍

@nibblesnbits
Copy link

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
Copy link

"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
Copy link

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
Copy link

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
Copy link

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
Copy link

ccyfly commented Feb 21, 2022

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
Copy link

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
Copy link

wleenavo commented Mar 3, 2022

Remove nvm worked for me.

@angelroma
Copy link

angelroma commented Mar 7, 2022

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
Copy link

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
Copy link

LordParsley commented Mar 16, 2022

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
Copy link

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

@me-ibad
Copy link

me-ibad commented May 20, 2022

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
Copy link

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
Copy link

bluefqcebaby commented Oct 31, 2022

my solution was delete nvm via brew
brew uninstall nvm

@zive-arildo
Copy link

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
Copy link

Uninstall nvm was my solution.

Just remove the folder, usually ~/.nvm

@matt-dalton
Copy link

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
    ?

@AnuragTiwari1
Copy link

AnuragTiwari1 commented Dec 6, 2022

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
Copy link

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

@raduvarga
Copy link

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
Copy link

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

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

@webdevpro129
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests