安装过程中遇到实在太多问题,记录下来帮后人填坑..
npm i react-native -g # 这个会报错
react-native init projectName --template typescript
找不到template.config

具体什么原因没细究,还是在stackoverflow上面找到解决方法,用react-native-cli
脚手架搭建
npm i react-native-cli -g
react-native init projectName --template typescript
然而事情并没有那么简单,RN第的坑才刚开始,一个叫boost-for-react-native
的东西install
失败

网上查到的原因是下载链接超时,但我是可以下载到安装包的(不明所以= =.)
查看第三方安装项目以及存放的目录路径,在projectName/node_modules/react-native/scripts/ios-install-third-party.sh
中

下载这些第三方包至~/Library/Caches/com.facebook.ReactNativeBuild
没有则创建,react-native
版本在0.57.8
及以下的放在~/.rncache
,下载放置完成之后,删除整个项目,重新init
(重新在项目ios中pod install
是不行的,我也不知道为啥..)
# 让我们再走一遍
react-native init projectName --template typescript
cd projectName/ios && pod install
At Last ! 终于成功了

react-native run-ios
网友评论