Aidan Low
Aidan Low

Reputation: 27

Your Ruby version is 2.3.1 but your Gemfile specified 2.5.1

Whenever I run a Rails command, it states that my Ruby version is 2.3.1 but my Gemfile specified 2.5.1. However, "ruby -v" returns "ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]", my path has no references to ruby 2.3.1, and running "rvm list" shows a properly green highlighted 2.5.1. Bundler is installed, and when I try to run bundle install inside a created Rails folder, a get another "Your Ruby version is 2.3.1 but your Gemfile specified 2.5.1" message. Please advise.

$PATH:

-bash: /home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/usr/share/rvm/rubies/ruby-2.5.1/bin:/usr/share/rvm/bin:/home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/home/alowverus/bin:/home/alowverus/.local/bin:/home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/home/alowverus/bin:/home/alowverus/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin: No such file or directory

Further information in response to answers: "which rails" returns "/home/alowverus/.rvm/gems/ruby-2.5.1/bin/rails", as expected

Upvotes: 0

Views: 3060

Answers (3)

Satish Sharma
Satish Sharma

Reputation: 31

Your Ruby version is 2.3.8, but your Gemfile specified 2.3.1

check ruby version with ruby -v [version like 2.3.8] make sure ruby version should be same on ruby versions as well as in your GemFile if you have not the same version then your put command on your bash_profile (terminal) rbenv global 2.3.8 & rbenv shell 2.3.8 (the version you can specified accordingly ) then delete your Gemfile.lock then install bundle and install bundler . these steps working form me.

rbenv global 2.3.8
rbenv shell 2.3.8
delete your Gemfile.lock
install bundle 
install bundler

Upvotes: 0

nitanshu verma
nitanshu verma

Reputation: 261

Create two files in the root one .ruby-version mention ruby-2.3.1 and .ruby-gemset mention @gemset-name and cd back to the same directory which will create the rvm wrapper for that application then run

rvm current

which outputs like something

ruby-2.3.1@gemset-name

then run

gem install bundler
bundle

may be helpful for you

Upvotes: 1

David S.
David S.

Reputation: 730

I would try (in no particular order):

  • which rails, is it the correct one?
  • bundle exec rails c (or whatever your command is)
  • rvm reload
  • To start clean, rvm implode and try reinstalling rvm and your Ruby version.

Upvotes: 0

Related Questions