“rails -v”出错

时间:2011-04-27 16:49:42

标签: ruby-on-rails ruby ruby-on-rails-3 macos rubygems

我正在研究Mac Snow Leapord

在安装RVM之前,我已尝试(但失败)升级OSX的默认ruby。

使用

完成Ruby的安装
rvm install 1.9.2

ruby -v

ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]

宝石是1.7.2 sudo gem install rails已安装的导轨 安装的Rails没有提示错误。

使用rails -v

/Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
    from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:244:in `activate_dep'
    from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:236:in `activate'
    from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1307:in `gem'
    from /Users/kyle/.rvm/rubies/ruby-1.9.2-p180/bin/rails:18:in `<main>'

我确实安装了gem,否则我无法进行gem install rails

有谁知道原因或解决方案?

2 个答案:

答案 0 :(得分:2)

问题是你在使用rvm时使用sudo来安装rails。试试这个:

$ rvm use 1.9.2
$ gem install rails

HTH

答案 1 :(得分:1)

要为当前用户安装gem install rails(不是sudo)吗?