react-native icon indicating copy to clipboard operation
react-native copied to clipboard

error: warn Multiple Podfiles were found when trying to init react-native project in mac os

Open codersandipdas opened this issue 1 year ago • 15 comments

Description

At first, when I tried to init a react-native project, "ruby version 2.5.7" error was shown.

I updated ruby successfully to the required version using the guide and rbenv

Now, when I am trying to create a new project I am getting multiple pod file errors.

Version

0.70.6

Output of npx react-native info

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

Steps to reproduce

I updated ruby successfully to the required version using the guide and benv

Snack, code example, screenshot, or link to a repository

Error image

codersandipdas avatar Jan 11 '23 06:01 codersandipdas

Exact same issue

Kompasua avatar Jan 30 '23 09:01 Kompasua

There is a section on the docs that suggests:

Go to the Locations panel and install the tools by selecting the most recent version in the Command Line Tools dropdown.

What happen to me is that I went there and I saw the version (only one in my case) and I assume it was selected already but you need to clicked and make sure it get selected by having a version under the select as the image below:

CleanShot 2023-01-31 at 11 07 01@2x

At least that worked for me. Also if you don't know how to open this panel just press CMD + , ✌️

duranmla avatar Jan 31 '23 10:01 duranmla

I have the same issue and just installed a clean react native

And my xcode shows exactly as @duranmla

System:
    OS: macOS 13.0
    CPU: (12) arm64 Apple M2 Pro
    Memory: 466.11 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
    Yarn: Not Found
    npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
    Watchman: 2023.01.30.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/tiagosa/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.18 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.2 => 0.71.2
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found   

tiagotedsky avatar Feb 02 '23 00:02 tiagotedsky

I have the same issue

arthurhts avatar Feb 04 '23 01:02 arthurhts

I was able to solve this issue by performing the following steps:

  1. Updated ruby successfully to the required version using the guide and rbenv.
  2. Installed the latest Xcode from Appstore.
  3. Done this setting.

codersandipdas avatar Feb 04 '23 11:02 codersandipdas

did anyone find a solution ?

anis-18 avatar Feb 07 '23 14:02 anis-18

I have the same issue and just installed a clean react native

And my xcode shows exactly as @duranmla

System:
    OS: macOS 13.0
    CPU: (12) arm64 Apple M2 Pro
    Memory: 466.11 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
    Yarn: Not Found
    npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
    Watchman: 2023.01.30.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/tiagosa/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.18 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.2 => 0.71.2
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found   

did you find a solution ?

anis-18 avatar Feb 07 '23 14:02 anis-18

Hi there!

The warning about multiple Podfile should not stop you from building the app. However, I put up a PR to fix this for new apps.

Probably, the problem is a misconfiguration of the environment. To make sure of it, could you try to manually install the pods by (from a Terminal):

  1. navigate to your app folder
  2. cd ios
  3. bundle install (you need to run this only once)
  4. bundle exec pod install This should give us a better diagnostic of your problem.

Thank you so much.

cipolleschi avatar Feb 09 '23 17:02 cipolleschi

Hi there!

The warning about multiple Podfile should not stop you from building the app. However, I put up a PR to fix this for new apps.

Probably, the problem is a misconfiguration of the environment. To make sure of it, could you try to manually install the pods by (from a Terminal):

  1. navigate to your app folder
  2. cd ios
  3. bundle install (you need to run this only once)
  4. bundle exec pod install This should give us a better diagnostic of your problem.

Thank you so much.

what to do when we get the error when trying to create a project not creating bulid?

codersandipdas avatar Feb 09 '23 18:02 codersandipdas

You should try the step I explained above.

There is something not correctly configured in the environment, thus the init command fails to install the pods.

By navigating into the ios folder, you can install the pods manually running bundle install (only once per project) and then bundle exec pod install.

This should output a more explorative message to help you fix the environment. Once fixed - and I can support you in setting that up once we have the right error - future init command will work!

cipolleschi avatar Feb 09 '23 20:02 cipolleschi

Running gem uninstall cocoapods and gem install cocoapods helped me.

Screenshot 2023-03-07 at 8 46 13 PM

PrantoshB avatar Mar 07 '23 15:03 PrantoshB

For me after doing pod repo update it crashed with some strange error:

You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: https://www.ruby-lang.org/bugreport.html

[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.

zsh: abort      pod repo update```

artak-avanesian avatar Mar 07 '23 21:03 artak-avanesian

@artak-avanesian, this look like an incomplete stack trace. There is no error here at all. It just say that you may have encountered a bug in the Ruby interpreter but there is nothing more... Could you provide some more info?

cipolleschi avatar Mar 08 '23 13:03 cipolleschi

just created a new file using npx react-native@latest init AwesomeProject and encountered the same warning.

since I'm also using rbenv, and the AwesomeProject/.ruby-version file is included, I deleted the AwesomeProject/vendor folder.

project builds fine now without the warning.

skam22 avatar Mar 08 '23 19:03 skam22

If you are concerned about the multiple podfile warning:

  1. We already fixed and it will be removed in the next version of RN
  2. It is just a warning: it won't prevent you from creating an app. If pod install is failing, the problem is somewhere else, not in the warning.

cipolleschi avatar Mar 09 '23 10:03 cipolleschi

Thanks @cipolleschi for the explanation. trying to create my first react native app, and having to battle this was not a great first impression, but I will still give it a go (y)

erlandsen-tech avatar Mar 10 '23 15:03 erlandsen-tech

I'm happy that you will try again! 😃

Please, feel free to post any issues and reach out for help. We are committed in trying to improve the experience as much as we can (e.g.: solving that warning, or - spoiler for the next releases - removing the requirement of a specific ruby-version) so all your reports are extremely valuable for us!

cipolleschi avatar Mar 10 '23 15:03 cipolleschi

That sounds awesome. The whole thing was a bit of a nightmare with the ruby thing, but when I first got it up and running, it seems really nice. Currently making some exiting stuff, so stay tuned ;)

erlandsen-tech avatar Mar 10 '23 18:03 erlandsen-tech

There is a section on the docs that suggests:

Go to the Locations panel and install the tools by selecting the most recent version in the Command Line Tools dropdown.

What happen to me is that I went there and I saw the version (only one in my case) and I assume it was selected already but you need to clicked and make sure it get selected by having a version under the select as the image below:

CleanShot 2023-01-31 at 11 07 01@2x

At least that worked for me. Also if you don't know how to open this panel just press CMD + , ✌️

This worked for me also

prashanthpadimala07 avatar Mar 17 '23 08:03 prashanthpadimala07

There is a section on the docs that suggests:

Go to the Locations panel and install the tools by selecting the most recent version in the Command Line Tools dropdown.

What happen to me is that I went there and I saw the version (only one in my case) and I assume it was selected already but you need to clicked and make sure it get selected by having a version under the select as the image below: CleanShot 2023-01-31 at 11 07 01@2x At least that worked for me. Also if you don't know how to open this panel just press CMD + , ✌️

This worked for me also

also me too

halilugur avatar Mar 20 '23 21:03 halilugur

There is a section on the docs that suggests:

Go to the Locations panel and install the tools by selecting the most recent version in the Command Line Tools dropdown.

What happen to me is that I went there and I saw the version (only one in my case) and I assume it was selected already but you need to clicked and make sure it get selected by having a version under the select as the image below: CleanShot 2023-01-31 at 11 07 01@2x At least that worked for me. Also if you don't know how to open this panel just press CMD + , ✌️

This worked for me also

also me too

me too

biapar avatar Mar 26 '23 19:03 biapar

4. bundle exec pod install

I did the following, and got the following error:

[!] CocoaPods could not find compatible versions for pod "hermes-engine":
  In snapshot (Podfile.lock):
    hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)

  In Podfile:
    hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)

It seems like you've changed the version of the dependency `hermes-engine` and it differs from the version stored in `Pods/Local Podspecs`.
You should run `pod update hermes-engine --no-repo-update` to apply changes made locally.

mkabatek avatar Mar 27 '23 00:03 mkabatek

@mkabatek your hermes version is not aligned with the one downloaded by react native. The error message contains instructions on how to fix it: pod update hermes-engine --no-repo-update

Try to run this command and see if it fixes the issue! :D

cipolleschi avatar Mar 27 '23 10:03 cipolleschi

@cipolleschi Thank for you reply, I realize that, and running the command does fix the issue. However I'm working off the following repo, https://github.com/thecodingmachine/react-native-boilerplate/issues/344 and trying to understand why this error occurs. There must be an incorrect version listed somewhere for cocopods or something 🤷‍♀️

mkabatek avatar Mar 28 '23 16:03 mkabatek

There is a section on the docs that suggests:

Go to the Locations panel and install the tools by selecting the most recent version in the Command Line Tools dropdown.

What happen to me is that I went there and I saw the version (only one in my case) and I assume it was selected already but you need to clicked and make sure it get selected by having a version under the select as the image below:

CleanShot 2023-01-31 at 11 07 01@2x

At least that worked for me. Also if you don't know how to open this panel just press CMD + , ✌️

this solution worked for me as well

oneeb-asad avatar Apr 04 '23 17:04 oneeb-asad

@oneeb-asad this is properly setup in my environment in xcode and the problem persists.

mkabatek avatar Apr 05 '23 04:04 mkabatek

@mkabatek If I understand correctly:

  1. npx react-native init fails due to incorrect hermes versions
  2. when you run pod update hermes-engine --no-repo-update, you manage to update the pods successfully
  3. You ca then open Xcode and build the project, right?

What happens if after step 2, you try to run yarn ios from the project root, instead?

Also, which version of React Native are you using?

cipolleschi avatar Apr 06 '23 08:04 cipolleschi

Is it possible to do the Android setup only? The tool assumes you need to setup both platforms, hence the issue with iOS. I know is not solving the issue, but would it be any way of skipping iOS altogether?

amypellegrini avatar Apr 13 '23 16:04 amypellegrini

Hi @amypellegrini! Yes, you can create a new React Native app with npx react-Native unit <AppName> --skip-install.

This creates a new app from the React Native template, without installing any dependencies.

Which means that you have to run yarn install manually, but it will skip the iOS setup.

cipolleschi avatar Apr 14 '23 08:04 cipolleschi

What is the solution?I also encountered this problem

haiqinJack avatar Apr 22 '23 17:04 haiqinJack