Home > Net >  Rails and Ruby versions always conflict, and will never be able to bundle install
Rails and Ruby versions always conflict, and will never be able to bundle install

Time:12-26

I git cloned my own repo, when I want to start (rails s), there will be a request to install Rails (sudo apt install ruby-railties), even though I installed it. If I start the installation (gem install rails), there will be a message that the Ruby version is too old:

ERROR: Error installing rails:
        There are no versions of activesupport (= 7.0.0) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?
        activesupport requires Ruby version >= 2.7.0. The current ruby ​​version is 2.6.6.146.

If I switch to the requested version (rvm use 2.7), the following message will appear when I run rails s:

Could not find proper version of railties (6.1.4.1) in any of the sources
Run `bundle install` to install missing gems.

When I proceed to bundle install, there will be a need to switch the Ruby version:

Your Ruby version is 2.7.2, but your Gemfile specified 2.6.6

This is equivalent to going back to the beginning. This stupid loop prevented me from completing the bundle install and thus rails s.

CodePudding user response:

Use cd to go into the directory of the Rails project that you have created. Then use bundle install to install the required gems. Once bundler is finished you should be able to run rails s.

CodePudding user response:

Regarding the pg error, you need to change your 'pg' gem to a lower version. Let us see what you have in your gemfile.

  • Related