1

Hello I am getting an issue when trying to run react-native init.

SyntaxError: Unexpected token ...

/Users/jordan/Projects/React/LiveInstagram/node_modules/metro-bundler/build/lib/TerminalClass.js:141 this._nextStatusStr = util.format(format, ...args);

Does anyone know how I can remedy this issue? Thanks!

j5juice
  • 623
  • 3
  • 8
  • 19
  • 1
    perhaps it's the rest operator `...` that is not understood – Jaromanda X Jul 06 '17 at 03:03
  • Well that is what the error looks like, but since it is in the metro-bundler I don't know how to fix that. – j5juice Jul 06 '17 at 11:45
  • What's your node version? @j5juice – Chiamaka Nwolisa Jul 06 '17 at 18:00
  • 4.6.0 is my Node version. 5.0.3 is NPM version. 2.0.1 is react-native-cli version. – j5juice Jul 06 '17 at 22:10
  • My answer to this question was deleted by reviewer, but this is possible duplicate question, answered the same issue here: https://stackoverflow.com/a/45267703/1292050 – Syed Jul 24 '17 at 15:44
  • Possible duplicate of [What means of no bundle URL present in react-native?](https://stackoverflow.com/questions/42610070/what-means-of-no-bundle-url-present-in-react-native) – Syed Jul 24 '17 at 15:47
  • This link [link ](https://stackoverflow.com/questions/41051572/react-native-init-awesomeproject-throwing-syntaxerror/51385120#51385120) can be useful to you – Mahdi Bashirpour Jul 17 '18 at 15:25

4 Answers4

2

There are compatibility issues in the updated react-native cli. Using the downgraded version solves this problem. $ react-native init [project name] --version 0.38.0

https://github.com/facebook/react-native/issues/11384

Mustehssun Iqbal
  • 576
  • 3
  • 19
2

Currently it works for me with node v8. My solution:

sudo npm install -g npm
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Hiep Dinh
  • 654
  • 5
  • 8
0

So I completely uninstalled Node then reinstalled it and react-native-cli and it worked correctly.

j5juice
  • 623
  • 3
  • 8
  • 19
0

I had the same problem with nodejs v4, solve this by updating nodejs and npm. sudo purge nodejs npm curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs

Leois
  • 21
  • 2