Skip to content

Command /bin/sh failed with exit code 127 #3946

Closed
@shahzeb1

Description

@shahzeb1

(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

Activity

topicus

topicus commented on Nov 6, 2015

@topicus

Same issue here.

adamtwiss

adamtwiss commented on Nov 6, 2015

@adamtwiss

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
MicheleBertoli

MicheleBertoli commented on Nov 6, 2015

@MicheleBertoli

+1

ffugly

ffugly commented on Nov 6, 2015

@ffugly

+1

shahzeb1

shahzeb1 commented on Nov 6, 2015

@shahzeb1
Author

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.

bradbyte

bradbyte commented on Nov 6, 2015

@bradbyte

Thanks @shahzeb1, that solved my problem.

TalkingQuickly

TalkingQuickly commented on Nov 6, 2015

@TalkingQuickly

+1

l-lawliett

l-lawliett commented on Nov 6, 2015

@l-lawliett

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

asamiller

asamiller commented on Nov 6, 2015

@asamiller

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

shahzeb1

shahzeb1 commented on Nov 6, 2015

@shahzeb1
Author

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

nvcken

nvcken commented on Nov 7, 2015

@nvcken

same here.
+1

m20io

m20io commented on Nov 7, 2015

@m20io

+1

m20io

m20io commented on Nov 7, 2015

@m20io

Anybody figured out a solution for this with android?

m20io

m20io commented on Nov 7, 2015

@m20io

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

sarahsalder

sarahsalder commented on Nov 7, 2015

@sarahsalder

+1

35 remaining items

adokania

adokania commented on Mar 3, 2016

@adokania

What worked for me is running 'npm start' from react-native root..

hchoriq

hchoriq commented on Mar 3, 2016

@hchoriq

nvm alias default v5.6.0 did it for me. It was referencing an older node version by default.

jsierles

jsierles commented on Mar 20, 2016

@jsierles
Contributor
facebook-github-bot

facebook-github-bot commented on Mar 20, 2016

@facebook-github-bot
Contributor

Closing this issue as @jsierles says the question asked has been answered. Please help us by asking questions on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

SudoPlz

SudoPlz commented on Mar 21, 2016

@SudoPlz
Contributor

For people that still struggle with this, THIS so answer immediately solved my problem with 1 click.

Muneefm

Muneefm commented on May 3, 2016

@Muneefm

Hi.
i had this issue couple days ago. and i was stuck with this. i tried everything i saw in here and stackoverflow. and at last i sorted out the issue.

my issue was i had already installed the node.js for some other reason.. and when i started with react native i reinstalled the node through nvm. but it seams like react was using the node that i have already installed. i guess that was old version. anyway so i just removed every node modules. and reinstalled everything. this answer helped me for that. http://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x

SudoPlz

SudoPlz commented on Jun 3, 2016

@SudoPlz
Contributor

SOLVED: For people looking for an answer to this in the future just add the line this SO post says. http://stackoverflow.com/questions/37230040/why-does-mainjs-bundle-not-build-with-reactnative-0-25-1/37614200#37614200

locked as resolved and limited conversation to collaborators on Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jsierles@strefethen@gpbl@stoitsev@gre

        Issue actions

          Command /bin/sh failed with exit code 127 · Issue #3946 · facebook/react-native