0

After upgrading my react native app to version 0.59.8 i made it work on android but when trying to build it and run in on ios it shows me this error :

node_modules/react-native/node_modules/@react-native-community/cli/build/cliEntry.js:168
async function run() {
    ^^^^^^^^
SyntaxError: Unexpected token function
            at createScript (vm.js:56:10)
            at Object.runInThisContext (vm.js:97:10)
            at Module._compile (module.js:542:28)
            at Object.Module._extensions..js (module.js:579:10)
            at Module.load (module.js:487:32)
            at tryModuleLoad (module.js:446:12)
            at Function.Module._load (module.js:438:3)
            at Module.require (module.js:497:17)
            at require (internal/module.js:20:19)
            at Object.<anonymous> 

Even when doing react-native info or react-native start or react-native run-ios , it shows the same error , Do you Know please what does it mean this error ?

2
  • What version of node are you using? Commented Jul 25, 2019 at 8:56
  • node's version v6.11.0 Commented Jul 25, 2019 at 9:01

1 Answer 1

1

Async functions are not supported in your version of Node. You really only have two options.

  1. To install Babel, to compile the javascript in a way that can be understood (transpiled)

  2. Upgrade your version of Node

I would HIGHLY recommend to upgrade Node.

How to upgrade node:

https://www.surrealcms.com/blog/how-to-upgrade-or-downgrade-nodejs-using-npm.html

EDIT

I've just come across this SO post from @Quentin - which explains this better. (Kudos) so, I thought I'd include

SyntaxError: Unexpected token function - Async Await Nodejs

Sign up to request clarification or add additional context in comments.

1 Comment

i'm really very thankful .It works now like a charm after upgrading my node's version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.