美文网首页
Mac React-Native环境搭建

Mac React-Native环境搭建

作者: 圣艾修 | 来源:发表于2019-11-04 16:53 被阅读0次

首先查看官方文档

brew install node
brew install watchman
npm install -g yarn react-native-cli

  • 新建项目

cd desktop
react-native init AwesomeProject
cd AwesomeProject
react-native run-ios

  • 错误信息:React/RCTBridgeDelegate.h' file not found
error Could not find "Podfile.lock" at /Users/zhanghuan/Desktop/AwesomeProject/ios/Podfile.lock. Did you run "pod install" in iOS directory?
info Found Xcode project "AwesomeProject.xcodeproj"
info Launching iPhone 11 (iOS 13.1)
info Building (using "xcodebuild -project AwesomeProject.xcodeproj -configuration Debug -scheme AwesomeProject -destination id=F866A062-4F9E-412C-B272-5832A81E3631 -derivedDataPath build/AwesomeProject")
.......................................
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening AwesomeProject.xcodeproj. Run CLI with --verbose flag for mo
** BUILD FAILED **
The following build commands failed:
    CompileC /Users/zhanghuan/Desktop/AwesomeProject/ios/build/AwesomeProject/Build/Intermediates.noindex/AwesomeProject.build/Debug-iphonesimulator/AwesomeProject.build/Objects-normal/x86_64/AppDelegate.o /Users/zhanghuan/Desktop/AwesomeProject/ios/AwesomeProject/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
1.png

解决:
安装pod
AwesomeProject目录下ios文件夹

cd ios
pod install

关掉模拟器,重新执行

cd ..
react-native run-ios

1.png

相关文章

网友评论

      本文标题:Mac React-Native环境搭建

      本文链接:https://www.haomeiwen.com/subject/ycpdbctx.html