Incorrect ruby version when installing bundle in rails project - ruby-on-rails

I have a problem when running bundle install in the root of sharetribe rails's project. It shows me this error message:
Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1
I tried installing rvm and installing the 2.3.1 version required to run this project but nothing changes and it still throwing this output.
Have anyone faced this problem before ?

Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1
Steps to resolve this issue
1)rvm install ruby-2.3.1
2)gem install bundler
3)rvm use ruby-2.3.1
4)Bundle install

Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1
If you run command ruby -v you can see that you have installed Ruby 2.4.0, when you look at the first line in your Gemfile specifies that you want to use Ruby 2.3.1.
You can do either install Ruby 2.3.1 or replace the first line in your Gemfile to with Ruby 2.4.0.

What does it say when you run bundle env in the terminal?
Is it the same ruby version?
I tried gem install bundler one time i had the same problem and bundle updated and worked.
You can read more about it here.
Good luck!

Related

Your Ruby version is 2.3.3, but your Gemfile specified 2.1.10

I am trying to run bundle on 2.1.10 ruby version. using rbenv and my local and global is both ruby 2.1.10 but everytime i try to server or bundle it says.
Your Ruby version is 2.3.3, but your Gemfile specified 2.1.10
what would be the best possible way to fix or figure out the problem.
Run rvm use 2.1.10 if you used rvm to install ruby
if it is not installed it will give you the instructions to do it:
Required ruby-2.1.10 is not installed.
To install do: 'rvm install "ruby-2.1.10"'

Mismatched ruby version after downgrade from 2.4.1 to 2.3.3 while running bundle install

While attempting to solve another issue identified in this thread:
Error while trying to load the gem 'devise. ActiveSupport: Duration can't be coerced into Integer, I followed the suggested solution and changed my ruby version from 2.4.1 to 2.3.3 using rbenv. I also made similar changes in my Gemfile to reflect the new ruby version. However, when I tried to bundle install again, it throws an error saying that my ruby version is 2.4.1, when my Gem specified 2.3.3. However, running ruby -v shows my ruby version is on 2.3.3.
$ bundle install
Your Ruby version is 2.4.1, but your Gemfile specified 2.3.3
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
Any help here would be appreciated. Thank you!
Gem installation is specific to ruby version, so the bundler you're using is likely installed to your old ruby. Try installing bundler again:
gem install bundler
That should fix your problem.

Rails Seeing Incorrect Ruby Version

I've built a Rails 5 app and it's working great but I'd like to change the Ruby version I'm running it on. I'm using RVM 1.27.0 on Ubuntu 16.04. I copied the app folder to a different path and changed the versions on .ruby_version and my Gemfile:
Gemfile:
source 'https://rubygems.org'
ruby "2.2.2"
.ruby_version:
ruby-2.2.2
Once I updated these I moved out and back into the folder and ran a ruby -v:
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
I then ran a bundle install and everything installed without error.
However, when I ran rake -T I get this:
Your Ruby version is 2.3.1, but your Gemfile specified 2.2.2.
My $PATH looks good:
/home/ken/.rvm/gems/ruby-2.2.2/bin:/home/ken/.rvm/gems/ruby-2.2.2#global/bin:/home/ken/.rvm/rubies/ruby-2.2.2/bin:/home/ken/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
What am I missing? Where is Rails pulling the Ruby version from? How can I fix this?
You're using a system bundler which is why you're seeing a different version of ruby. All you need to do is install bundler under your current ruby version:
gem install bundler
bundle install
Once you do a bundle install you'll get the gem's built for the correct ruby version.
The file name should be .ruby-version, not .ruby_version.
And you also should have file .ruby-gemset with content
gemset
check this link, Create .ruby-version and .ruby-gemset with rvm
You can also try spring stop and gem install bundler

An error occurred while installing autoprefixer-rails (6.2.2). Additionally it say's "autoprefixer-rails requires ruby version >= 2.0. "

Im facing this problem when i'm installing bunder using command "bunlde install"
Initially i tried solving this issue by using following command
gem install autoprefixer-rails -v '6.2.2'
but again it said "autoprefixer-rails requires ruby version >= 2.0."
when i type
"ruby -v", my ruby version shows 2.3.0.
Next i have tried adding
ruby '2.3.0' to my gem file, then there was a conflict saying your ruby version is 1.9.3 but your gem file has 2.3.0
Need help how to proceed further.
Change your ruby version in the system first. If you using rvm then use following command.
rvm use 2.3.0
If you don't have it then install it by following command
rvm install 2.3.0
Delete the Gemfile.lock file and run
bundle install
Hopefully it will work. Thank you

Your Ruby version is 2.2.4, but your Gemfile specified 2.3.0?

I'm trying to bundle install a ruby project in Git Bash but I'm getting the above message.
ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [i836-mingw32]
gem -v
2.3.0
New to Ruby so its really frustrating. I'm trying to do the project below
http://www.viralrails.com/?p=25
This happens because you are specifying a Ruby version in your Gemfile (2.3.0) and this version is not installed or is not the current or default version.
Don't remove the line ruby '2.3.0' as someone said above. You app may have dependencies to this version. Do the following:
1) Check if you have Ruby 2.3.0 installed. If you are using rvm this may be done by
rvm list
and if you are using rbenv by
rbenv versions
2) If you don't have this Ruby version in your list of installed versions, then install it by issuing the following command
rvm install 2.3.0
and if you are using rbenv by
rbenv install 2.3.0
3) If you already had Ruby 2.3.0 installed or completed step 2 above, enter your app directory and issue the following command
rvm use 2.3.0
and if you are using rbenv by
rbenv local 2.3.0
Then run
bundle install
and I believe things will be ok.
Hope it helps!
Install bundler after installing ruby 2.4.0.
gem install bundler
If you installed bundler before installing ruby 2.4.0 then you should reinstall bundler or update it.
Also if the above command didn't work.
gem update bundler

Resources