reactnativecn / react-native-website

React Native 中文网
https://reactnative.cn
MIT License
220 stars 328 forks source link

根据官网搭建环境,创建项目,yarn iOS报错 #845

Closed GentleCai-CH closed 4 months ago

GentleCai-CH commented 5 months ago

问题的具体描述

根据官网搭建环境,创建项目,yarn iOS报错。途中 xcode的ios模拟器的安装,与官网有出入,因为xcode不太一样。

另外xcode不能打开RN项目,只能打开RN项目里面的iOS目录。

报错信息如下:

error Failed to build ios project. "xcodebuild" exited with error code '65'. To debug build logs further, consider building your app with Xcode.app, by opening 'AwesomeProject.xcodeproj'. Command line invocation: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project AwesomeProject.xcodeproj -configuration Debug -scheme AwesomeProject -destination id=CA73C2BF-CDE7-41A1-BFD0-0C5A3179D769

User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES ...........

BUILD FAILED

sunnylqm commented 5 months ago

xcode打开ios目录里的xcworkspace后缀文件

GentleCai-CH commented 5 months ago

这是来自QQ邮箱的自动回复邮件。你好,你所发送的邮件我已收到,待查阅后必要时我会回复。请耐心等待。

sunnylqm commented 5 months ago

如果没有xcworkspace文件,就是pod没有初始化完成,在ios目录中运行pod install看具体报错

GentleCai-CH commented 5 months ago

如果没有xcworkspace文件,就是pod没有初始化完成,在ios目录中运行pod install看具体报错

[Hermes] Using release tarball from URL: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.74.2/react-native-artifacts-0.74.2-hermes-ios-debug.tar.gz [!] CDN: trunk Repo update failed - 11 error(s): CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.1/SocketRocket.podspec.json Response: Timeout was reached CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.2.0/SocketRocket.podspec.json Response: Timeout was reached CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.3.1-beta2/SocketRocket.podspec.json Response: Timeout was reached CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.4/SocketRocket.podspec.json Response: Timeout was reached CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.4.1/SocketRocket.podspec.json Response: Timeout was reached CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.4.2/SocketRocket.podspec.json Response: Timeout was reached CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.5.0/SocketRocket.podspec.json Response: Timeout was reached CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.5.1/SocketRocket.podspec.json Response: Timeout was reached CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.6.0/SocketRocket.podspec.json Response: Timeout was reached CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.6.1/SocketRocket.podspec.json Response: Timeout was reached CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/Specs/a/9/3/SocketRocket/0.7.0/SocketRocket.podspec.json Response: Timeout was reached

sunnylqm commented 5 months ago

网络问题,需要代理

GentleCai-CH commented 5 months ago

网络问题,需要代理

谢啦。并没有用。

sunnylqm commented 5 months ago

那是你的代理配置有问题

GentleCai-CH commented 5 months ago

问题解决了! 重新多次创建项目,与之前有两点不同:

1、卸载安装过的react-native-cli命令行工具:

发现跟随官网搭建程序后,创建项目时,需要卸载安装过的react-native-cli命令行工具(尽管之前没有安装过),运行官网给的命令:

       npm uninstall -g react-native-cli @react-native-community/cli

2、创建项目过程中,提示安装cocoapods。安装cocoapods后,有出现一些提示,其中有:

 Run instructions for iOS:
    • cd "/Users/gentle/Downloads/rnpj/AwesomeProject/ios"
    
    • Install Cocoapods
      • bundle install # you need to run this only once in your project.
      • bundle exec pod install
      • cd ..
    
    • npx react-native run-ios
    - or -
    • Open AwesomeProject/ios/AwesomeProject.xcodeproj in Xcode or run "xed -b ios"
    • Hit the Run button

主要是运行了这两句,安装了不同的依赖

• bundle install # you need to run this only once in your project.
• bundle exec pod install

后面创建的项目就都有 xxx.xcworkspace文件了。

小白不懂,只记录客观流程。

GentleCai-CH commented 5 months ago

那是你的代理配置有问题

问题解决了,貌似不是网络问题

calvingit commented 5 months ago

@GentleCai-CH 你解决了就可以关闭 issue

GentleCai-CH commented 5 months ago

好的

---原始邮件--- 发件人: @.> 发送时间: 2024年7月2日(周二) 中午12:07 收件人: @.>; 抄送: @.**@.>; 主题: Re: [reactnativecn/react-native-website] 根据官网搭建环境,创建项目,yarn iOS报错 (Issue #845)

@GentleCai-CH 你解决了就可以关闭 issue

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>