react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Command /bin/sh failed with exit code 127

Open shahzeb1 opened this issue 11 years ago • 52 comments

(Using Node version v4.2.1)

This is the terminal window when I click on build inside of XCode:

/Users/bla/Documents/ios-apps/emesgee/node_modules/react-native/local-cli/cli.js:56
  const setupEnvScript = /^win/.test(process.platform)
  ^^^^^
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:935:3
Process terminated. Press <enter> to close the window

shahzeb1 avatar Nov 06 '15 09:11 shahzeb1

Same issue here.

topicus avatar Nov 06 '15 14:11 topicus

Same here ... happy to help with any diagnostics. I am using react-native-cli 0.1.7 and Node v5.0.0

I thought I'd have a quick try at just commenting out the 'use strict;' in cli.js to see if that would fix it.

But then I get:

/Users/adam/Documents/code/AwesomeProject/node_modules/react-native/local-cli/cli.js:104
class CreateSuppressingTerminalAdapter extends TerminalAdapter {
^^^^^
SyntaxError: Unexpected reserved word
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
Process terminated. Press <enter> to close the window

adamtwiss avatar Nov 06 '15 15:11 adamtwiss

+1

MicheleBertoli avatar Nov 06 '15 15:11 MicheleBertoli

+1

ffugly avatar Nov 06 '15 15:11 ffugly

Temporary workaround (to at least get React Native working):

  1. Use node version v4.2.1
  2. cd into [your app]/node_modules/react-native/packager
  3. Run ./packager.sh (for some reason this runs fine)
  4. Go into XCode and go to the Build Phases tab.
  5. Remove the last item on the list (the one that runs the script). So you're left with Target Dependencies, Compile Sources, Link Binary With Libraries, and Copy Bundle Resources.

Now hit build in XCode. Since the shell script is no longer part of the XCode build routine, it shouldn't fail. And if you have the react native client server running in another terminal window, then everything should run fine.

shahzeb1 avatar Nov 06 '15 15:11 shahzeb1

Thanks @shahzeb1, that solved my problem.

bradbyte avatar Nov 06 '15 16:11 bradbyte

+1

TalkingQuickly avatar Nov 06 '15 16:11 TalkingQuickly

Thats greate but all you need to do is just delete the last Item in Build Phase in Xcode perfect not a work around dont need to cd into anything after that

l-lawliett avatar Nov 06 '15 18:11 l-lawliett

~~Running react-native upgrade fixed this for me.~~ Update: Sorry, turns out this didn't fix it.

asamiller avatar Nov 06 '15 20:11 asamiller

@asamiller So I had to cd into the project directory and then run react-native upgrade. That did update certain files, but it did not fix the issue for me.

shahzeb1 avatar Nov 06 '15 21:11 shahzeb1

same here. +1

nvcken avatar Nov 07 '15 05:11 nvcken

+1

m20io avatar Nov 07 '15 14:11 m20io

Anybody figured out a solution for this with android?

m20io avatar Nov 07 '15 15:11 m20io

ok it seams to be enough to run separatly [your app]/node_modules/react-native/packager/packager.sh

m20io avatar Nov 07 '15 15:11 m20io

+1

sarahsalder avatar Nov 07 '15 17:11 sarahsalder

@shahzeb1 your workaround worked for me as well. thanks

sarahsalder avatar Nov 07 '15 17:11 sarahsalder

related https://github.com/facebook/react-native/issues/3948

gre avatar Nov 09 '15 10:11 gre

Deleting that build step works and all, but I'm pretty sure that step is required to get the new assets system working when you bundle for running on device... At least, that's what I'm experiencing...no images appear when bundled.

marcshilling avatar Nov 09 '15 22:11 marcshilling

That's what I thought too. Images are acting all kinds of weird after deleting this step.

paulgessinger avatar Nov 10 '15 00:11 paulgessinger

+1

huitsing avatar Nov 10 '15 00:11 huitsing