When I changed my Gemfile version to 2.6.3, I got the error message "Your Ruby version is 2.7.2, but your Gemfile specified 2.6.3", and when I changed my Gemfile version to 2.7.2, I got the error message "Your Ruby version is 2.6.3, but your Gemfile specified 2.7.2".
When I run rails in my home directory, it works, but when I run in my specific directory, it gives me the error messages above, and my ruby version keeps switching from 2.6.3 and 2.7.2 even though when I run ruby -v I get ruby 2.7.2p137.
I've tried all the solutions I could find, like running bundle install and updating my path, but I can't find the solution. Any help will be appreciated, thank you!
This is my gem environment:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.4
- RUBY VERSION: 2.7.2 (2020-10-01 patchlevel 137) [x86_64-darwin19]
- INSTALLATION DIRECTORY: /Users/yeanjyoo/.gem
- USER INSTALLATION DIRECTORY: /Users/yeanjyoo/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /Users/yeanjyoo/.gem/bin
- SPEC CACHE DIRECTORY: /Users/yeanjyoo/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.7.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-19
- GEM PATHS:
- /Users/yeanjyoo/.gem
- /usr/local/Cellar/ruby/2.7.2/bin/ruby
- /usr/local/opt/ruby/bin/ruby
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Library/Frameworks/Python.framework/Versions/3.8/bin
- /Users/yeanjyoo/.rbenv/bin
- /Users/yeanjyoo/.rbenv/bin
- /usr/local/Cellar/ruby/2.7.2/bin
- /usr/local/pgsql/bin
- /usr/local/opt/ruby
- /Library/Apple/usr/bin
- /usr/bin
- /bin
- /usr/local/git/bin
- /usr/local/bin
- /usr/local/git/bin
- /usr/local/bin
This is my path: echo $PATH
/Library/Frameworks/Python.framework/Versions/3.8/bin:/Users/yeanjyoo/.rbenv/bin:/Users/yeanjyoo/.rbenv/bin:/usr/local/Cellar/ruby/2.7.2/bin:/usr/local/pgsql/bin:/usr/local/opt/ruby:/Library/Apple/usr/bin:/usr/bin:/bin:/usr/local/git/bin:/usr/local/bin:/usr/local/git/bin:/usr/local/bin
question from:
https://stackoverflow.com/questions/65873886/your-ruby-version-is-2-6-3-but-your-gemfile-specified-2-7-2 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…