我是跟着RN官网的教程来玩的:
https://facebook.github.io/react-native/docs/getting-started.html#content
求解惑
/Users/yiwang/Documents/react_native/AwesomeProject/node_modules/react-native/local-cli/cli.js:56
const setupEnvScript = /^win/.test(process.platform)
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Module._extensions..js (module.js:478:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/yiwang/Documents/react_native/AwesomeProject/node_modules/react-native/node_modules/babel-core/lib/api/register/node.js:214:7)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/yiwang/Documents/react_native/AwesomeProject/node_modules/react-native/cli.js:15:18)
巴扎黑2017-04-17 13:03:45
You need to upgrade node, but if you are using nvm to manage node version.
Use node use <different versions> directly. If your system version is lower than the version required by react-native, there will also be problems.
Because react-native will open a new window when it starts, if you do not configure it in a configuration file such as .xxx, there will still be problems.
1. It is recommended to use nvm to manage node (it is very likely that you do not want to abandon the project of the old version of node for some reason);
2. Use nvm alias default stable (the latest version is used as the default version here, required Use nvm install stable to install the latest version)
Wish you good luck!