Ruby 2.0 is running, but Rails 4 doesn't see it.

What am I doing wrong??

****@ubuntu:~/ruby/things_i_bought$ rake db:migrate

    Rails 4 prefers to run on Ruby 2.0.

    You're running       ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]

    Please upgrade to Ruby 1.9.3 or newer to continue.

****@ubuntu:~/ruby/things_i_bought$ ruby -v ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux] ****@ubuntu:~/ruby/things_i_bought$ rvm list

rvm rubies

   ruby-1.9.3-p374 [ i686 ]    ruby-1.9.3-p392 [ i686 ] =* ruby-2.0.0-p0 [ i686 ]

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

****@ubuntu:~/ruby/things_i_bought$

Check:

$ which rake $ `which rake` --version

I suspect you aren't executing the one in the Rails.root/bin directory.

Tamara Temple wrote in post #1111066:

ruby-2.0.0-p0/bin/rake

that's 2.0 correct?

Thanks for the help, BTW.

IDK. I'm out of ideas. :frowning:

ruby-2.0.0-p0/bin/rake

that's 2.0 correct?

Yes, it is.

Thanks for the help, BTW.

Wish I could offer an answer..

Tamara Temple wrote in post #1111076:

What am I doing wrong??

****@ubuntu:~/ruby/things_i_bought$ rake db:migrate

    Rails 4 prefers to run on Ruby 2.0.

    You're running       ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]

Try bundle exec rake db:migrate

Colin

Colin Law wrote in post #1111099:

What am I doing wrong??

****@ubuntu:~/ruby/things_i_bought$ rake db:migrate

    Rails 4 prefers to run on Ruby 2.0.

    You're running       ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]

Try bundle exec rake db:migrate

Colin

****@ubuntu:~/ruby/things_i_bought$ bundle exec rake db:migrate

    Rails 4 prefers to run on Ruby 2.0.

    You're running       ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]

    Please upgrade to Ruby 1.9.3 or newer to continue.

****@ubuntu:~/ruby/things_i_bought$

nope, thanks though

Hmmm…

I don’t see any output of which ruby, probably missordered PATH-variable? Please check.

HTH

Norbert

sean@ubuntu:~/ruby/things_i_bought$ echo $PATH /home/sean/.rvm/gems/ruby-2.0.0-p0/bin:/home/sean/.rvm/gems/ruby-2.0.0-p0@global/bin:/home/sean/.rvm/rubies/ruby-2.0.0-p0/bin:/home/sean/.rvm/bin:/home/sean/sbt/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/bin/:/home/sean/AWS-ElasticBeanstalk-CLI-2.3.1/eb/linux/python2.7/:/home/sean/anaconda/bin/

and here's the relevent section of my .bashrc file:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM

Also, when I type in `which ruby` it freezes the console.

Norbert Melzer wrote in post #1111200:

"Also, when I type in which ruby it freezes the console. "

I think whatever ruby you think you’re running is damaged. Based on the rails output about needing 2.0 but having 1.8.7 I guessing you’ld be well served by uninstalling 2.0 and redoing the install. How about if you type “ruby --version” in your console, does that also hang?

Okay, I tried that. I uninstalled all previous version of ruby with rvm. Now the only version of ruby on my machine is 2.0: sean@ubuntu:~/ruby$ rvm list

rvm rubies

=* ruby-2.0.0-p0 [ i686 ]

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

sean@ubuntu:~/ruby$

But, it's still not working. I also tried uninstalling and reinstalling rails4 through gem. Now rails 4 is the only version of rails on my machine. I think next I'll try uninstalling rake. Maybe it's rake.

Thanks anyway.

sean@ubuntu:~/ruby/things_i_bought$ echo $PATH /home/sean/.rvm/gems/ruby-2.0.0-p0/bin:/home/sean/.rvm/gems/ruby-2.0.0-p0@global/bin:/home/sean/.rvm/rubies/ruby-2.0.0-p0/bin:/home/sean/.rvm/bin:/home/sean/sbt/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/bin/:/home/sean/AWS-ElasticBeanstalk-CLI-2.3.1/eb/linux/python2.7/:/home/sean/anaconda/bin/

and here's the relevent section of my .bashrc file:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM

Also, when I type in `which ruby` it freezes the console.

In that case you have a serious problem that is nothing to do with ruby itself. All which does (AFAIK) is to look in the path for the file to execute.

Colin

no that works. I was typing it with the grave accents. I guess grave accents freeze my console.

sean@ubuntu:~$ which ruby /home/sean/.rvm/rubies/ruby-2.0.0-p0/bin/ruby sean@ubuntu:~$

Still, I don't know how to get Rails 4 to recognize Ruby 2....

1 check if you have .ruby-version file

2 check the contents of your Gemfile for references to ruby 1.8 or Force it to use ruby 2.0

3 rm Gemfile.lock and rebuild

reinstalled rvm and rubygems. Now everything works.. Case closed. Thank you everyone for the help. You have my eternal gratitude.