1、安装Homebew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2、安装Node.js4.0或更高版本
3、安装watchman brew install watchman
4、安装xcode7.0或更高版本
5、安卓android studio
6、$ npm install -g react-native-cli
7、react-native init AwesomeProject
你可能会出现如下报错:
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EACCES: permission denied, open '/Users/leicunjie/.babel.json'
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.writeFileSync (fs.js:1156:15)
at save (/Users/leicunjie/HelloWorld/node_modules/react-native/node_modules/babel-register/lib/cache.js:57:40)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
解决办法:改变.babel.json文件的访问权限
zhangxus-MacBook-Air:~ Brisy$ ls -al | grep .babel.json
-rw-r--r-- 1 root staff 9801451 9 17 10:26 .babel.json
zhangxus-MacBook-Air:~ Brisy$ sudo chown Brisy ~/.babel.json
Password:
zhangxus-MacBook-Air:~ Brisy$ ls -al | grep .babel.json
-rw-r--r-- 1 Brisy staff 9801451 9 17 10:26 .babel.json
然后重新react-native init 项目名称