Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

better_errors requires Ruby version >= 2.0.0

Tags:

ruby

gem

bundle

Bundle fails to install better_errors.

Gem::InstallError: better_errors requires Ruby version >= 2.0.0.
An error occurred while installing better_errors (2.0.0), and Bundler cannot continue.
Make sure that `gem install better_errors -v '2.0.0'` succeeds before bundling.

But gem install better_errors works fine.

ruby --version says ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux-gnu]. I already tried upgrading to 2.1 but still not working.

Any suggestions?

like image 743
Raphael Marco Avatar asked Sep 14 '14 12:09

Raphael Marco


3 Answers

I had this same problem. In my case, the bundler script had

 #!/usr/bin/ruby

as the initial line in the script. As a result, it was calling the system (non-rbenv) version, which was 1.9.1 (in Linux Mint)

It's pretty hacky but changing that first line by running

sudo nano /usr/local/bin/bundle

to the full path for the rbenv shim (in my case):

 #!/home/$YOUR_USERNAME/.rbenv/shims/ruby

solved the problem.

like image 88
james Avatar answered Sep 20 '22 22:09

james


Hi for all the people who have different versions of ruby in their machine, and even if

rvm use ruby-version doesn't work.

Try this,

rvm list this will specify all the ruby version in your machine.

rvm rubies

 * ruby-1.9.3-p484 [ x86_64 ]
   ruby-2.1.0-preview2 [ x86_64 ]
   ruby-2.1.1 [ x86_64 ]
=> ruby-2.1.5 [ x86_64 ]

In your project root folder, just create a file

.ruby-version

and add the ruby version you are planning to use.

ruby-2.1.5

Thats it, restart your application and try reinstalling your gems. :)

like image 32
Ronak Jain Avatar answered Sep 21 '22 22:09

Ronak Jain


If you use rvm, make sure you don't have an .rvmrc file at the root of your project that force ruby < 2.0 to run, same with rbenv and .ruby-version file

like image 34
Geraud Mathe Avatar answered Sep 19 '22 22:09

Geraud Mathe