0

I'm currently trying to create my first ever react native project, following the environment setup directions on https://reactnative.dev. I followed every step of the quickstart guide. The error appears when I try to do the step "creating a new application", with the command npx react-native@latest init MyProject, at which point I get the following error message:

error warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.6.0/gems/cocoapods-core-1.12.1/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. 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 (/Users/myname/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:131:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.initialize [as func] (/Users/myname/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:184:3) at async Command.handleAction (/Users/myname/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/index.js:106:9)

I'm not sure what to do next. I ran npm uninstall -g react-native-cli @react-native-community/cli before trying to initialize my project, if that matters.

I'm using: yarn = 3.5.0, cocoa pod = 1.12.1, node = 18.15.0, ruby = 2.6.10p210

4
  • Can you add your cocoapods version, yarn version, node version, ruby version in your questions? Commented Apr 21, 2023 at 2:35
  • The error message tells you what to do. Did you complete the steps in the quickstart guide? Edit the question and show what you did to set it up. Commented Apr 21, 2023 at 4:45
  • @GuyIncognito yes, like I said in my post, I followed the directions on the quickstart guide. Edited it to reiterate and add more detail :-) Commented Apr 21, 2023 at 6:00
  • Please provide enough code so others can better understand or reproduce the problem. Commented Apr 21, 2023 at 16:57

1 Answer 1

0

What you can try to do is the following:

  1. Create a react-native.config.js file in the root directory of your project, and add this:

   module.exports = {
     project: {
       ios: {
         sourceDir: './ios',
       },
     },
   };

  1. In the terminal, run: cd ios, then run pod install to install all the necessary dependencies.
  2. After that, cd .. to navigate to the root of the project, then run yarn start and yarn ios to run the project.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.