Rails not using correct version of Ruby

后端 未结 9 2261
春和景丽
春和景丽 2021-02-14 15:20

New information

This is what happens with rails console:

Loading development environment (Rails 3.1.1)
ruby-1.9.2-p290 :001 &         


        
相关标签:
9条回答
  • 2021-02-14 15:34

    You should set default ruby like:

    rvm use 1.9.2 --default
    

    This will override system installed ruby with rvm one.

    Updated:

    notme, thank you for remark

    Leading double hyphen before default is significant to set default ruby.

    Below listed detailed & self-explained example, enjoy:

    $ruby -v
    ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]
    
    $rvm list
    rvm rubies
    
       ruby-1.9.2-p290 [ i386 ]
    
    $rvm use 1.9.2 --default
    Using /usr/local/rvm/gems/ruby-1.9.2-p290
    
    $rvm list default
    
    Default Ruby (for new shells)
    
       ruby-1.9.2-p290 [ i386 ]
    
    $rvm use default
    Using /usr/local/rvm/gems/ruby-1.9.2-p290
    
    $ruby -v
    ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
    
    $rvm list 
    
    rvm rubies
    
    => ruby-1.9.2-p290 [ i386 ]
    
    0 讨论(0)
  • 2021-02-14 15:37

    Try to use:

    rvm --default use 1.9.2
    
    0 讨论(0)
  • 2021-02-14 15:42

    PATH is probably wrong - check printenv PATH

    0 讨论(0)
  • 2021-02-14 15:46

    I would go for bad gem/rails install:

    gem empty
    gem update --system
    gem install bundler --no-ri --no-rdoc
    gem install rails --no-ri --no-rdoc
    
    0 讨论(0)
  • 2021-02-14 15:47

    Are you using Passenger or Pow to run your Rails apps? If so you'll need to set the server to use rvm 1.9.2

    See section 2.3 here, for example: http://pow.cx/manual.html#section_2

    Or for passenger: http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/

    0 讨论(0)
  • 2021-02-14 15:49

    Make sure you didn't use sudo with RVM. I ran into an issue like this where I had 2 different locations for Ruby and my gems.

    0 讨论(0)
提交回复
热议问题