Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native run-ios packager build error - AwesomeProject quick start

Tags:

react-native

The problem

Open react native issue here

I have researched this error extensively (~ 2days dev time) but somehow still no resolution - I have run previous React Native setups fine and thought this might resolve as a final step (see the end of issue). In short, when I run react-native run-ios from example "AwesomeProject" directory I get the below error in the React Packager launchPackager.command window.

~/AwesomeProject2/node_modules/react-native/packager ~ /Users/alexanderhandy/AwesomeProject2/node_modules/react-native/local-cli/cli.js:74

const setupEnvScript = /^win/.test(process.platform)

SyntaxError: Use of const in strict mode.

at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

My setup

  • Macbook Pro 2012 - OS X 10.11 El Capitan
  • Xcode (v7.2.1)
  • Node (v5.7.0) and NVM (0.31.0)
  • React Native (v0.20.0)

Steps

  • Upgraded laptop to El Capitan (as per version above) - hadn't used much for last 6 months so was coming back to run some setup
  • Attempted react native setup and got an error running homebrew when tried to install. Found some unexpected changes to many files when ran git status -- so went into the relevant usr/local homebrew directory and ran git fetch; git reset --hard origin/master
  • Updated Xcode to over v7 (as per version above)
  • Installed nvm and latest node to address error warning from Node - note: for some reason have to run . ~/.nvm/nvm.sh in terminal to get nvm working, when I don't v5.7.0 becomes v0.12.4. I have double-checked node is v5.7.0 when error runs
  • Finally got through to actually building an app when ran react-native init AwesomeProject which completed but hanged for like 10 mins
  • Ran react-native run-ios and got error and tried to add source ~/.bash_profile to node_modules/react-native/packager/react-native-xcode.sh as suggested here
  • Considered going back to Ionic so went through their setup again and that wouldn't work either
  • Tried not to throw my laptop out the window
like image 989
AlexHandy1 Avatar asked Feb 28 '16 20:02

AlexHandy1


1 Answers

I had the same problem when creating my project from react-native init command. What I did to get a successful build was do npm install babel and then finally do react-native run-ios. Hope this helps.

like image 66
TheFlyBiker 420 Avatar answered Nov 14 '22 05:11

TheFlyBiker 420