jfog
jfog

Reputation: 81

How do I resolve "Could not locate Gemfile" when trying to initialise a react native project?

When running the command npx react-native init myProject --version 0.63.0 it gives back the error:

✖ Installing Bundler
error Could not locate Gemfile

I am using react-native 0.63 as I am on Mac OS 10.13.6. Xcode 12 is required for react-native 0.64, which I can't get on this old OS (please don't suggest to upgrade it's not a feasible solution). I understand the error is caused by a Gemfile not existing in the project directory, but how can I resolve this?

I have followed the installation steps as per https://reactnative.dev/docs/0.63/environment-setup.

Here is the output when I run cd myProject && gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 3.1.6
  - RUBY VERSION: 2.7.4 (2021-07-07 patchlevel 191) [x86_64-darwin17]
  - INSTALLATION DIRECTORY: /Users/toast/.rvm/gems/ruby-2.7.4
  - USER INSTALLATION DIRECTORY: /Users/toast/.gem/ruby/2.7.0
  - RUBY EXECUTABLE: /Users/toast/.rvm/rubies/ruby-2.7.4/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /Users/toast/.rvm/gems/ruby-2.7.4/bin
  - SPEC CACHE DIRECTORY: /Users/toast/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/toast/.rvm/rubies/ruby-2.7.4/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-17
  - GEM PATHS:
     - /Users/toast/.rvm/gems/ruby-2.7.4
     - /Users/toast/.rvm/rubies/ruby-2.7.4/lib/ruby/gems/2.7.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/toast/.rvm/gems/ruby-2.7.4/bin
     - /Users/toast/.rvm/gems/ruby-2.7.4@global/bin
     - /Users/toast/.rvm/rubies/ruby-2.7.4/bin
     - Users/toast/bin/dafny
     - /usr/local/share/dotnet/dotnet
     - /Users/toast/.cargo/bin
     - /Library/Frameworks/Python.framework/Versions/3.7/bin
     - /Library/Frameworks/Python.framework/Versions/3.8/bin
     - /Library/Frameworks/Python.framework/Versions/3.7/bin
     - /opt/local/bin
     - /opt/local/sbin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Users/toast/.rvm/bin

Proof of my installations

$ ruby --version
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-darwin17]
$ rvm --version
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
$ gem --version
3.1.6
$ pod --version
1.10.1

Upvotes: 4

Views: 5428

Answers (1)

civani mahida
civani mahida

Reputation: 342

Use below command for install/update cocoapods

sudo gem install cocoapods

then create app with npx react-native init myProject --version 0.66.4

Upvotes: 0

Related Questions