I am getting this error while running server, how do I fix this?
-
I don't know if you have already fixed this issue but if not, please read this article . makandracards.com/makandra/… – Sergey Nikolayevich Dec 13 '17 at 14:36
You better install Ruby 2.2.5 for compatibility. The Ruby version in your local machine is different from the one declared in Gemfile.
If you're using rvm:
rvm install 2.2.5
rvm use 2.2.5
else if you're using rbenv:
rbenv install 2.2.5
rbenv local 2.2.5
else if you can not change ruby version by rbenv, read here
-
Backward compatibility is not an issue, I think. If it were the opposite (Gemfile specifying 2.3.0 and only 2.2.5 installed) we would have some issues, for sure. – Ed de Almeida Jun 20 '16 at 5:22
-
@EddeAlmeida what if I don't want to change the Gemfile? Like it's a project with multiple people? Or an open-source project – Emile Bergeron Dec 20 '16 at 2:50
-
Then install Ruby 2.2.5, create a private bundle for your app and go ahead, @EmileBergeron. – Ed de Almeida Dec 20 '16 at 2:55
-
1These situations are exactly the reasons why I always suggest people to have a separate bundle to each application. – Ed de Almeida Dec 20 '16 at 2:58
-
1I was having an issue between the local version of Ruby and the versions of Ruby that Heroku allows. I'm new-ish ro Ruby, Rails, and RVM, so this took me a bit to figure out. Thanks a TON, Tan. Specifically, no other answer I found in a couple hours of poking around mentioned the rvm use command. – Henry Edward Quinn IV Jan 20 '17 at 15:24
If you have already installed 2.2.5 and set as current ruby version, but still showing the same error even if the Ruby version 2.3.0 is not even installed, then just install the bundler.
gem install bundler
and then:
bundle install
-
3This is it right here! Because if you installed bundler before installing and setting your ruby version, calling
bundle check
orbundle install
will still be referencing the ruby environment that was used for installingbundler
originally. Cheers! – Joshua Pinter Oct 11 '18 at 5:09 -
5
-
2
If you are using rbenv then make sure that you run the "rbenv rehash" command after you set local or global ruby version. It solved the issue for me.
rbenv rehash
Your Gemfile has a line reading
ruby '2.2.5'
Change it to
ruby '2.3.0'
Then run
bundle install
-
how to upgrade that? iam already installed railsinstaller from this link s3.amazonaws.com/railsinstaller/Windows/… – unknown Jun 20 '16 at 8:08
-
I believe Aptana Studio has a command to update, but I never used it. – Ed de Almeida Jun 21 '16 at 18:34
-
Your suggestion didn't do anything for me, but running
gem update
fixed the error message for me. – Allison Apr 29 '18 at 2:59 -
1
-
1Yes, @AnthonyKal. .ruby-gemset states the name of the private bundle and .ruby-version the ruby version it will be based on. – Ed de Almeida Oct 30 '18 at 10:44
Two steps worked for me:
gem install bundler
bundle install --redownload # Forces a redownload of all gems on the gemfile, assigning them to the new bundler
A problem I had on my Mac using rbenv was that when I first set it up, it loaded a bunch of ruby executables in /usr/local/bin - these executables loaded the system ruby, rather than the current version.
If you run
which bundle
And it shows /usr/local/bin/bundle you may have this issue.
Search through /usr/local/bin and delete any files that start with #!/user/bin ruby
Then run
rbenv rehash
I had this problem but I solved it by installing the version of the ruby that is specified in my gem file using the RVM
rvm install (ruby version)
After the installation, I use the following command to use the the version that you installed.
rvm --default use (ruby version)
You have to install bundler by using the following command in order to use the latest version
gem install bundler
After the above steps, you can now run following command to install the gems specified on the gemfile
bundle install
I am on Mac OS Sierra. I had to update /etc/paths
and add /Users/my.username/.rbenv/shims
to the top of the list.
For $
Your Ruby version is 2.3.0, but your Gemfile specified 2.4.1.
Changed 2.4.1 in Gemfile to 2.3.0