react-native: Command /bin/sh failed with exit code 127

(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

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 52 (8 by maintainers)

Most upvoted comments

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.