react-native ---遇到的问题汇总

1、新建的项目总是跑不起来。。。

今天同事给个项目,下载下来npm install后一堆问题,大概就是路径出问题了

xcrun: error: active developer path ("/Users/XJW/Desktop/Xcode.app/Contents/Developer") does not exist, use `xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools (or see `man xcode-select`)

百度一下,使用下面的命令,再npm install后就可以了

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

然后 react-native run-ios还是卡住

在项目根目录使用命令:

rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json

就跑起来了,虽然现在还不明白原理,还是记录一下,以后慢慢分析~

--------------------------------这是一条诺大的分割线-----------------------

经过长时间的尝试,终于今天解决了这个问题

办法很简单,简单到我都不敢相信!!!把xcode升级到最新版本!原来是8.3.2 现在是9.3,现在新建的项目可以正常运行了!

2、error:The following binaries use incompatible versions of Swift

解决方法:

xcode>product>clean>退出xcode

在项目根目录输入命令:rm -rf ~/Library/Developer/Xcode/DerivedData 

重新运行项目,build succeed!

3、error:xcrun: error: unable to find utility "instruments", not a developer tool or in PATH

解决方法:进入终端  sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/

4、error:RCTViewManager.h' file not found

解决方法:进入项目根目录 执行npm install 重新运行

5、error:Xcode 工程文件打不开,cannot be opened because the project file cannot be parsed. (代码更新时,可能有这种情况)

解决方法:

这是因为.xcodeproj工程文件冲突了,冲突消息信息:

<<<<<<< .mine 9ADAAC6A15DCEF6A0019ACA8 .... in Resources */, ======= 52FD7F3D15DCEAEF009E9322 ... in Resources */, >>>>>>> .r269

1.对.xcodeproj 文件右键,显示包内容

2.双击打开 project.pbxproj 文件

3.找到以上类似的冲突信息(可以用commad + f 搜索)

4.删除 <<<<<<<,======,>>>>>>这些行

5.保存,退出

6.重新打开.xcodeproj文件即可






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值