react-native cocoapods Error message : Looks like your iOS environment is not properly set

341 Views Asked by At

-When I configure the environment and run the following command

npx react-native init AwesomeProject

Error message

An error occurred while installing json (2.6.3), and Bundler cannot continue.
Make sure that `gem install json -v '2.6.3' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  cocoapods was resolved to 1.11.3, which depends on
    cocoapods-core was resolved to 1.11.3, which depends on
      algoliasearch was resolved to 1.27.5, which depends on
        json

✖ Installing Bundler
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.
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.
    at createFromTemplate (/opt/homebrew/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/init/init.js:129:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.initialize [as func] (/opt/homebrew/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/init/init.js:181:3)
    at async Command.handleAction (/opt/homebrew/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:106:9)
info Run CLI with --verbose flag for more details.

I hope that no error will be reported when downloading the project

-Additional information

  • my Ruby version is :2.7.6
  • my Mac is :macOs Monterey 12.5.1
  • my Xcodeis :14.2(14C18)
  • my pod is : 1.11.3
1

There are 1 best solutions below

0
On

What worked for me was to open Xcode > Settings > Locations and make sure the Command Line Tools matched the version of Xcode I have installed.

Please note that due to ongoing issues with React Native and Xcode version 14.3 at least, you will most likely need to have another version of Xcode installed, and change the version of the Command Line Tools to either the version below, or the next version up. This will enable to you to build on the iOS simulator from your React Native project folder.