react native 更新后packager启动失败:SyntaxError: Unexpected token ...

更新了下react native版本,突然发现packager就无法启动了。报错SyntaxError: Unexpected token ... 具体如下:

######### Starting Packager ##########

######### Executing command: react-native start --port 8081 ##########
/Users/liduola-android/duola-for-js/node_modules/metro-bundler/src/lib/Terminal.js:141
this._nextStatusStr = util.format(format, ...args);
^^^

SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Module._extensions..js (module.js:416:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/liduola-android/duola-for-js/node_modules/metro-bundler/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/Users/liduola-android/duola-for-js/node_modules/react-native/local-cli/server/runServer.js:18:18)
at Module._compile (module.js:409:26)
[Error : 0106] Failed to start the React Native packager: Could not start the packager.

在这里找到了解决办法:github  原因是react native 0.46之后使用ES6语法,如果node版本太低,就无法识别...这种延伸操作符,所以需要更新到node v6以上。

node 更新的方法在这里:点击打开链接 

你可能感兴趣的:(react native 更新后packager启动失败:SyntaxError: Unexpected token ...)