无法启动新的 React 原生应用,因为 iOS 环境设置不正确

无法启动新的 React 原生应用,因为 iOS 环境设置不正确 _大数据知识库 (saoniuhuo.com)open in new window

npx react-native init project_adji --template react-native-template-typescript
报错

Downloading template
✔ Copying template
✔ Processing template
✔ Installing Bundler
✖ Installing CocoaPods dependencies (this may take a few minutes)
error warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
gem uninstall cocoapods
sudo xcodebuild -license accept
npx react-native init tempProject --skip-install
cd tempProject
yarn install
cd ios
bundle install
bundle exec pod install
Last Updated:
Contributors: 刘荣杰