Rails 需要 Rubygems,但我有 gem

Rails 需要 Rubygems,但我有 gem

更新:我注意到了这一点which ruby,并whereis ruby报告了不同的位置:

which ruby
/opt/local/bin/ruby
whereis ruby
/usr/bin/ruby

我最近将 ruby​​ 升级到了,ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]但我认为我破坏了 rails。当我尝试加载 rails 时,我收到一条奇怪的消息:

$ ruby​​ script/server
Rails 需要 RubyGems >= 1.3.2。请安装 RubyGems 并重试:http://rubygems.rubyforge.org

知道哪里出了问题吗?

$ rails -v
Rails 3.0.0.beta
$ gem -v
1.3.6
$ which gem
/usr/bin/gem
$ whereis gem
/usr/bin/gem
$ which rails
/usr/bin/rails
$ whereis rails
/usr/bin/rails
$ /usr/bin/gem -v
1.3.6
$ /usr/bin/rails -v
Rails 3.0.0.beta
$ ruby script/console

Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org
$ gem list rails

*** LOCAL GEMS ***

rails (3.0.0.beta, 2.3.5, 2.2.2, 1.2.6)

$ gem list 

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.0.beta, 2.3.5, 2.2.2, 1.3.6)
actionpack (3.0.0.beta, 2.3.5, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activemerchant (1.4.1)
activemodel (3.0.0.beta)
activerecord (3.0.0.beta, 2.3.5, 2.2.2, 1.15.6)
activerecord-tableless (0.1.0)
activeresource (3.0.0.beta, 2.3.5, 2.2.2)
activesupport (3.0.0.beta, 2.3.5, 2.2.2, 1.4.4)
acts_as_ferret (0.4.3)
arel (0.2.pre)
authlogic (2.1.3)
builder (2.1.2)
bundler (0.9.3)
calendar_date_select (1.15)
capistrano (2.5.2)
cgi_multipart_eof_fix (2.5.0)
chronic (0.2.3)
columnize (0.3.1)
compass (0.8.17)
daemons (1.0.10)
dnssd (0.6.0)
erubis (2.6.5)
fastercsv (1.5.0)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.6)
flay (1.4.0)
flog (2.4.0)
gbarcode (0.98.16)
gem_plugin (0.2.3)
git (1.2.5)
haml (2.2.15)
haml-edge (2.3.100)
highline (1.5.0)
hoe (2.4.0)
hpricot (0.6.164)
i18n (0.3.3)
javan-whenever (0.3.7)
jeweler (1.4.0)
jscruggs-metric_fu (1.1.5)
json_pure (1.2.0)
libxml-ruby (1.1.2)
linecache (0.43)
mail (2.1.2)
mechanize (0.9.3)
memcache-client (1.7.8)
mime-types (1.16)
mislav-will_paginate (2.3.11)
mocha (0.9.7)
mojombo-chronic (0.3.0)
mongrel (1.1.5)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.1)
net-ssh (2.0.4, 1.1.4)
net-ssh-gateway (1.0.0)
nifty-generators (0.3.0)
nokogiri (1.4.0)
openrain-action_mailer_tls (1.1.3)
passenger (2.2.5)
polyglot (0.2.9)
prawn (0.6.3)
prawn-core (0.6.3)
prawn-format (0.2.3)
prawn-layout (0.3.2)
prawn-security (0.1.1)
rack (1.1.0, 1.0.1)
rack-mount (0.4.5)
rack-test (0.5.3)
rails (3.0.0.beta, 2.3.5, 2.2.2, 1.2.6)
railties (3.0.0.beta)
rake (0.8.7, 0.8.3)
rake-compiler (0.6.0)
RedCloth (4.1.1)
reek (1.2.6)
relevance-rcov (0.9.2.1)
rmagick (2.12.2)
roodi (2.1.0)
rsl-stringex (1.0.3)
rspec (1.2.9)
rspec-rails (1.2.9)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
ruby-openid (2.1.2)
ruby-yadis (0.3.4)
ruby2ruby (1.2.4)
ruby_parser (2.0.4)
rubyforge (2.0.3)
rubygems-update (1.3.6, 1.3.5)
rubynode (0.1.5)
searchlogic (2.3.9)
sexp_processor (3.0.3)
spree (0.9.4)
sqlite3-ruby (1.2.5, 1.2.4)
termios (0.9.4)
test-unit (2.0.5)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.13.0)
tlsmail (0.0.1)
topfunky-gruff (0.3.5)
treetop (1.4.3)
tzinfo (0.3.16)
xmpp4r (0.4)

答案1

伙计们,给聪明人一句忠告。如果你在任何类似 Linux/Mac 的环境中使用 Ruby,请使用 RVM -https://rvm.beginrescueend.com/.它将使你免于绝望。

答案2

我遇到了类似的问题;我通过 Mac Ports 更新了 Ruby,但我也应该通过 Mac Ports 更新 RubyGems:

sudo port install rb-rubygems

不过需要提醒的是,完成此操作后,我必须重新安装所有的 Gems。

相关内容