admin管理员组

文章数量:1391925

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!

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!

Share Improve this question asked Jul 6, 2017 at 3:02 j5juicej5juice 6633 gold badges8 silver badges20 bronze badges 7
  • 1 perhaps it's the rest operator ... that is not understood – Jaromanda X Commented Jul 6, 2017 at 3: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 Commented Jul 6, 2017 at 11:45
  • What's your node version? @j5juice – Chiamaka Nwolisa Commented Jul 6, 2017 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 Commented Jul 6, 2017 at 22:10
  • My answer to this question was deleted by reviewer, but this is possible duplicate question, answered the same issue here: stackoverflow./a/45267703/1292050 – Syed Commented Jul 24, 2017 at 15:44
 |  Show 2 more ments

5 Answers 5

Reset to default 2

There are patibility 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./facebook/react-native/issues/11384

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

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

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

I had an older node version. so upgraded to 18.17.1 and worked for react native 0.72.5

本文标签: javascriptSyntaxError Unexpected token reactnative initStack Overflow