简体   繁体   English

Rails需要RubyGems> = 1.3.2。 请安装RubyGems,然后重试(我有rubygems 1.3.6!)

[英]Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again (I have rubygems 1.3.6!)

I'm running rails version 2.3.5 and rubygems version 1.3.6, when I script/server I get this error 我正在运行Rails版本2.3.5和rubygems版本1.3.6,当我编写脚本/服务器时遇到此错误

Rails requires RubyGems >= 1.3.2. Rails需要RubyGems> = 1.3.2。 Please install RubyGems and try again: http://rubygems.rubyforge.org 请安装RubyGems,然后重试: http : //rubygems.rubyforge.org

any ideas how to fix this? 任何想法如何解决这一问题?

The first thing you should do is run: gem env 您应该做的第一件事是运行:gem env

This will output, amongst other things, the RUBYGEMS_VERSION and your GEM_PATHS. 除其他事项外,这将输出RUBYGEMS_VERSION和您的GEM_PATHS。 Verify that everything you think is true, is indeed true. 验证您认为一切正确的事实确实是真实的。

In the GEM_PATHS, you will probably see multiple paths, the top most being the primary path. 在GEM_PATHS中,您可能会看到多个路径,最上面的是主要路径。

You can set GEM_HOME to the primary gem directory in the your .bash_login/etc file. 您可以将GEM_HOME设置为.bash_login / etc文件中的主要gem目录。 Open a new terminal and run gem env again to make sure that it is being picked up. 打开一个新的终端,然后再次运行gem env以确保已将其拾取。

As Gordon indicated, make sure these GEM paths are in your PATH. 正如戈登指出的那样,确保这些GEM路径在您的PATH中。

Some other things to think about ownership/permissions. 关于所有权/权限的其他一些事情。 If you use sudo when working with gems on your system, they get installed in a different directory than when you install/update normally. 如果在系统上使用gem时使用sudo,则将它们安装在与正常安装/更新不同的目录中。

Perhaps you installed the rubygems using sudo, but rails is not running as root. 也许您使用sudo安装了rubygems,但是rails并非以root身份运行。

Read the installation notes if you still cannot figure it out: ruby gems installation 如果仍然无法理解,请阅读安装说明: ruby gems安装

Maybe it's not finding your correct gem path. 也许找不到正确的宝石路径。 I've had similar problems related to that. 我也有与此类似的问题。 You might need to update your bash prefs eg in .basrc you might have something like this: 您可能需要更新bash首选项,例如,在.basrc中,您可能会遇到类似以下情况:

GEMS=/home/me/ruby1.8/lib/ruby/gems/1.8/bin/ export PATH=$RUBY:$GEMS:$HOME/bin:$PATH:$NGINX:$MONIT:$GIT GEMS = / home / me / ruby​​1.8 / lib / ruby​​ / gems / 1.8 / bin / export PATH = $ RUBY:$ GEMS:$ HOME / bin:$ PATH:$ NGINX:$ MONIT:$ GIT

I just ran into this issue today, and for those of you who do something similar to what I did here is the fix and a little background. 我今天刚遇到这个问题,对于那些做与我在这里所做的事情相似的人的是修复和一些背景知识。

I was installing some dependencies for rmagik, took the easy way out and used macports, it automatically went ahead and updated my default ruby to /opt/... so rubygems went missing since it only intalled ruby. 我正在为rmagik安装一些依赖项,采取了简单的方法并使用了macports,它会自动进行并将我的默认ruby更新为/ opt / ...,所以rubygems丢失了,因为它只安装了ruby。

my advise, use rvm (http://rvm.beginrescueend.com/) like raphael_turtle says, since you will want RVM to be in charge of updating your links to ruby, rubygems and rails. 我的建议是,像raphael_turtle一样使用rvm(http://rvm.beginrescueend.com/),因为您将希望RVM负责更新指向ruby,rubygems和rails的链接。

*Be wary when installing via macports or brew, just make sure you see what else is being installed, and don't accidently overwrite your local configs. *通过macports或brew安装时请小心,只需确保您看到正在安装的其他东西,并且不要意外覆盖本地配置。

I had the same problem. 我有同样的问题。 My installation was done for me by technical support, so it was not me who did the installation (security problems). 我的安装是由技术支持为我完成的,所以不是我(安全问题)来完成安装。

The problem was that I didn't have some access rights, so this helped: 问题是我没有一些访问权限,所以这有所帮助:

sudo - su user_name_with_enough_access_rights

And then run scripts/server again. 然后再次运行脚本/服务器。

我不知道出了什么问题,所以我在rvm上安装了新版本的rails和ruby。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM