我正在尝试将React-native安装到我的ubuntu 14.04。我已成功安装react-native init reactApp
,但当我尝试运行pavlov@pavlov-System-Product-Name:~$ node -v
v0.12.7
pavlov@pavlov-System-Product-Name:~$ react-native init reactApp
prompt: Directory reactApp already exist. Continue?: (no) y
This will walk you through creating a new React Native project in /home/pavlov/reactApp
Installing react-native package from npm...
You are currently running Node v0.12.7 but React Native requires >=4. Please use a supported version of Node.
See https://facebook.github.io/react-native/docs/getting-started.html
/home/pavlov/reactApp/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] (/home/pavlov/reactApp/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> (/home/pavlov/reactApp/node_modules/react-native/cli.js:15:18)
at Module._compile (module.js:460:26)
trene时出错:
JButton openButton = new JButton(OpenAction);
openButton.setVerticalTextPosition(SwingConstants.BOTTOM);
openButton.setHorizontalTextPosition(SwingConstants.CENTER);
openButton.setText("Open");
bar.add(openButton);
我该如何解决?
答案 0 :(得分:1)
您肯定需要安装Node 4.0或更高版本。实际上它甚至在你的控制台输出中说出来。
以下是我在Ubuntu上安装Node的方法:
sudo apt-get install curl
curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install nodejs
祝你好运!
答案 1 :(得分:0)
转到https://nodejs.org/en/并下载最新版本,在本例中为v4.4.3。