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 ?

Karl
  • 854
  • 9
  • 21
stuudd
  • 329
  • 2
  • 9
  • 16

1 Answers1

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

JRK
  • 3,686
  • 1
  • 13
  • 19