参考文章:https://reactnative.cn/docs/getting-started.html
环境搭建(略,见参考文章)
问题描述
创建并运行项目
react-native-cli init HelloWorld
react-native run-ios //失败
使用xcode打开项目,手动run报错。
原因
0.45 及以上版本需要下载 boost 等几个第三方库。
查看当前项目的版本:
cd HelloWorld react-native -v
结果是
react-native-cli: 2.0.1 react-native: 0.58.6
解决办法
下载boost第三方库,地址:https://pan.baidu.com/s/1kVDUAZ9
cd ~/.rncache #文件夹不存在则手动创建
cp ~/Downloads/boost_1_63_0.tar.gz ~/.rncache
#重新编译
cd HelloWorld
rm -fr ./node_modules
npm install
#运行
react-native run-ios