react-native: [Getting Started] react-native run-ios got error: TransformError - Unexpected token

Is this a bug report?

Bundling index.ios.js [development, non-minified, hmr disabled] 0.0% (0/1), failed. error: bundling failed: “TransformError: /Users/imac/Documents/react-native/AwesomeProject/index.ios.js: Unexpected token ) (While processing preset: "/Users/imac/Documents/react-native/AwesomeProject/node_modules/babel-preset-react-native/index.js")”

Environment

  1. react-native -v: 0.47.1
  2. node -v: 6.10.2
  3. npm -v: 5.3.0

Then, specify:

  • Target Platform: iOS
  • Development Operating System: macOS Sierra
  • Build tools: Terminal

Steps to Reproduce

Follow step by step as guide Building Projects with Native Code http://facebook.github.io/react-native/docs/getting-started.html#getting-started

Actual Behavior

Got error message as screenshot: simulator screen shot aug 17 2017 10 45 59 am

screen shot 2017-08-17 at 10 56 06 am

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 18 (4 by maintainers)

Most upvoted comments

@phuongwd probably related with this #15513 try to change the version:

yarn remove babel-preset-react-native
yarn add babel-preset-react-native@2.1.0

@sharathprabhal , try to close the terminal that opened by the packager, it runs package at port 8081, close it will terminate the packager process, then you re-run react-native run-ios, it should work.

I’m running into this in ^5.0.0. Anyone else having this problem? I’ve tried several different versions of babel-preset-react-native and haven’t had any luck.