Question

ruby -v give me ruby-1.9.3-p194.
which ruby gives /home/ubuntu/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
rails -v gives Rails 3.2.7
which rails gives /home/ubuntu/.rvm/gems/ruby-1.9.3-p194/bin/rails

"sudo bundle exec rails s" gives:

ubuntu@ip-10-117-73-5:~/ruby/users$ sudo bundle exec rails s
=> Booting WEBrick
=> Rails 3.2.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-09-11 20:13:08] INFO  WEBrick 1.3.1
[2012-09-11 20:13:08] INFO  ruby 1.8.7 (2011-06-30) [i686-linux]
[2012-09-11 20:13:08] INFO  WEBrick::HTTPServer#start: pid=4240 port=3000

rvn info gives me:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.24
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i686-linux]
  - INSTALLATION DIRECTORY: /home/ubuntu/.rvm/gems/ruby-1.9.3-p194
  - RUBY EXECUTABLE: /home/ubuntu/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
  - EXECUTABLE DIRECTORY: /home/ubuntu/.rvm/gems/ruby-1.9.3-p194/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /home/ubuntu/.rvm/gems/ruby-1.9.3-p194
     - /home/ubuntu/.rvm/gems/ruby-1.9.3-p194@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

However when I run rails server I see below.

[2012-09-11 18:19:53] INFO  ruby 1.8.7 (2011-06-30) [i686-linux]

I have no clue where this is coming from.

I have done "bundle install" and "bundle update" and a whole slew of things - it still is using the wrong ruby version. What do I need to do?

EDIT: $PATH variable also only shows me 1.9.3 relevant information, how the heck is Webrick getting 1.8.7! If I remove that folder - it just doesn't start at all

Était-ce utile?

La solution

Well seems what i needed was

rvmsudo rails server

I am just now learning when to use sudo and when not to - this was a painful experience. Problem was that 1.8.7 was installed for sudo - while everything else was right for my user. But since I couldn't run 'rails server' by itself due to my previous incorrect installation, i had to use 'sudo rails server' - which ended up using the older ruby version.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top