Your Ruby version is 2.3.0, but your Gemfile speci

2019-07-03 04:54发布

问题:

I'm trying to setup an existing project, When running bundle install, I'm getting following error.

I've tried many possible solutions but didn't worked for me, also I've run the suggested commands, like gem pristine bcrypt --version 3.1.10 but didn't work for me.

    bipashant@bipashant-Inspiron-5537:~/sanokam$ bundle install

    Ignoring bcrypt-3.1.10 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.10
    Ignoring curb-0.9.3 because its extensions are not built.  Try: gem pristine curb --version 0.9.3
    Ignoring debug_inspector-0.0.2 because its extensions are not built.  Try: gem pristine debug_inspector --version 0.0.2
    Ignoring eventmachine-1.0.3 because its extensions are not built.  Try: gem pristine eventmachine --version 1.0.3
    Ignoring executable-hooks-1.3.2 because its extensions are not built.  Try: gem pristine executable-hooks --version 1.3.2
    Ignoring ffi-1.9.8 because its extensions are not built.  Try: gem pristine ffi --version 1.9.8
    Ignoring gem-wrappers-1.2.7 because its extensions are not built.  Try: gem pristine gem-wrappers --version 1.2.7
    Ignoring gherkin-2.12.2 because its extensions are not built.  Try: gem pristine gherkin --version 2.12.2
    Ignoring http_parser.rb-0.5.3 because its extensions are not built.  Try: gem pristine http_parser.rb --version 0.5.3
    Ignoring kgio-2.8.1 because its extensions are not built.  Try: gem pristine kgio --version 2.8.1
    Ignoring mysql2-0.3.14 because its extensions are not built.  Try: gem pristine mysql2 --version 0.3.14
    Ignoring nokogiri-1.6.7 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.7
    Ignoring ruby-prof-0.14.2 because its extensions are not built.  Try: gem pristine ruby-prof --version 0.14.2

    Your Ruby version is 2.3.0, but your Gemfile specified 2.1.2

Update 1

bipashant@bipashant-Inspiron-5537:~/sanokam$ rvm list

rvm rubies

=* ruby-2.1.2 [ x86_64 ]
   ruby-2.3.0 [ x86_64 ]
   ruby-2.3.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

And also I've a ruby version Gemfile.

source 'http://rubygems.org'

ruby '2.1.2'

Any suggestion will be appreciated, Thank you.

回答1:

Your Gemfile might have this line:

ruby '2.1.2'

And you are using ruby 2.3.0, so you could either:

  1. switch to ruby 2.1.2 with help of rvm/rbenv/chruby
  2. update your Gemfile to ruby '2.3.0' and bundle install again


回答2:

The error seems pretty clear. You either have to change the ruby version specified in your Gemfile, or change the ruby version you are using by doing rvm use 2.1.2. You can use rvm --default use 2.1.2 to make it the default version.