在使用ubuntu 14.04启动反应本机项目时获取此错误我已尝试使用root访问权限并更新节点version.help来解决问题
/usr/local/lib/node_modules/react-native-cli/index.js:266
const rnPackage = options.version;
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
FYR
root@syscon-ThinkCentre-E73:~# node -v
v0.10.25
root@syscon-ThinkCentre-E73:~# nodejs -v
v0.10.25
root@syscon-ThinkCentre-E73:~# npm -v
1.3.10
syscon@syscon-ThinkCentre-E73:~$ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
答案 0 :(得分:0)
对于react-native-cli的最新版本,您需要节点> = 4:https://github.com/facebook/react-native/blob/master/react-native-cli/package.json#L8
您可以在/usr/local/lib/node_modules/react-native-cli/package.json中查看所需的版本