node.js - React-native npm start启动报错!
伊谢尔伦
伊谢尔伦 2017-04-17 13:01:45
0
2
601

我是跟着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)
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
巴扎黑

Upgrade node to 4.1 or above.

巴扎黑

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!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template