使用 Ruby Enterprise Edition,gems 没有安装在我期望的位置
我刚刚安装了 Ruby Enterprise Edition,并正在为其安装一些 gem。 服务器上还安装了 Stock Ruby 1.8.6。
我已将 /opt/ruby-enterprise-1.8.6-20090201/bin
添加到我的 PATH
的 /usr/bin
头,其中 < code>ruby 和 gem
已上线。
which gem
确认了这一点:
/opt/ruby-enterprise-1.8.6-20090201/bin/gem
但是,当我像这样安装 gem 时:
gem install some_gem
它们最终位于 /usr/lib/ruby/gems/1.8/gems/
而不是 /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/ gems/1.8/gems/
.
但是,如果我使用 /opt/ruby-enterprise-1.8.6-20090201/bin/gem install some_gem
它确实进入 REE 的 gem 目录。
我不明白。 我需要更改一些配置选项吗? 我在这里使用 sudo。 也许这有什么关系?
I have just installed Ruby Enterprise Edition and am installing some gems for it. Stock Ruby 1.8.6 is also installed on the server.
I have added /opt/ruby-enterprise-1.8.6-20090201/bin
to my PATH
a head of /usr/bin
where ruby
and gem
live.
which gem
confirms this:
/opt/ruby-enterprise-1.8.6-20090201/bin/gem
However, when I install gems like this:
gem install some_gem
They end up in /usr/lib/ruby/gems/1.8/gems/
instead of /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/
.
But if I use /opt/ruby-enterprise-1.8.6-20090201/bin/gem install some_gem
it does go into REE's gem directory.
I don't get it. Is there some config option I have to change? I am using sudo here. Maybe that has something to do with it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这里有一个很好的解释:
sudo 更改 PATH - 为什么?
这假设你'正在使用 Ubuntu。 sudo确实改变了ubuntu下的路径。
/usr/bin/ 中的 gem 可能是 /usr/bin/gem1.8 的符号链接。 我所做的是将 ruby-enterprise 的 gem 符号链接到 /usr/bin/ree-gem,如下所示:
sudo ln -s /opt/ruby-enterprise-1.8.6-20090201/bin/gem /usr/bin/ree-gem
then我只是使用:
sudo ree-gem install some_gem
专门为 ree 安装 gem。 如果您不使用 ruby 1.8.6 rubygem,则可以将 REE 的 gem 符号链接到 /usr/bin/gem:
sudo ln -s /opt/ruby-enterprise-1.8.6-20090201/bin/gem /usr/垃圾箱/宝石
There's a good explanation of what's going on here:
sudo changes PATH - why?
This assumes you're using Ubuntu. sudo does change the path under ubuntu.
The gem you have in /usr/bin/ is probably a symlink to /usr/bin/gem1.8. What I did was symlink ruby-enterprise's gem to /usr/bin/ree-gem like this:
sudo ln -s /opt/ruby-enterprise-1.8.6-20090201/bin/gem /usr/bin/ree-gem
then I just use:
sudo ree-gem install some_gem
to install gems specifically for ree. If you're not using the ruby 1.8.6 rubygem, you can symlink REE's gem to /usr/bin/gem instead:
sudo ln -s /opt/ruby-enterprise-1.8.6-20090201/bin/gem /usr/bin/gem
我用于解决类似问题的解决方案是为 REE gem 命令设置别名。
IE
A solution I used to a similar problem is to set up an alias to your REE gem command.
I.e.
我在这里发布了我在 Ubuntu 上使用的解决方案:
http://groups.google.com/group/emm- ruby/browse_thread/thread/d0c685bbd096823a#msg_effa7d6ad42c541c
除了 Ruby Enterprise Edition 文档中描述的内容之外,还需要一些额外的步骤才能使其正常工作。
I posted the solution I used on Ubuntu here:
http://groups.google.com/group/emm-ruby/browse_thread/thread/d0c685bbd096823a#msg_effa7d6ad42c541c
There were some additional steps to get it working beyond what was described in the Ruby Enterprise Edition documentation.
以下是 REE 为何如此设置的解释: http://www.rubyenterpriseedition.com/ Documentation.html#_how_ree_installs_itself_into_the_system
Here's an explanation for why it's setup like this for REE: http://www.rubyenterpriseedition.com/documentation.html#_how_ree_installs_itself_into_the_system
除了上面 Jack Chu 有用的符号链接之外,我可以建议:
sudo ln -s /opt/ruby-enterprise/bin/rake /usr/bin/ree-rake
这样你就可以 sudo ree-rake gems:install
In addition to Jack Chu's helpful symlink above, might I suggest:
sudo ln -s /opt/ruby-enterprise/bin/rake /usr/bin/ree-rake
so you can sudo ree-rake gems:install