RVM红宝石如何找到宝石? [英] How do RVM rubies find gems?

查看:146
本文介绍了RVM红宝石如何找到宝石?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS X(10.9.2)的RVM下使用了Ruby 1.8.6。我将所有东西安装为本地用户(不是root),然后使用以下命令安装gem:

  gem install gli -v 1.6 

当我用 require('gli')

  in'require':no file to load  -  gli(LoadError)

即使 gem list 显示 gli(1.6.0)



我不确切知道RVM如何做它的gemsets,但是没有 $ LOAD_PATH

<$ c $>中的任何一个目录中的$ c> gli.rb
p> RVM如何与 $ LOAD_PATH 进行交互以在gemset中找到必要的gem?

解决方案

尝试在源文件的顶部添加 require'rubygems'>。在默认情况下,不需要1.8版的rubygems。

$ c> GEM_HOME 指示安装宝石的位置。要找出你的情况是什么:

  $ echo $ GEM_HOME 

这应该显示与RVM相关的路径,因为RVM会更改此环境变量以使 $ gem install 命令在其目录中安装宝石。


I'm using Ruby 1.8.6 under RVM on Mac OS X (10.9.2). I installed everything as a local user (not root), and then installed a gem using:

gem install gli -v 1.6

When I run a ruby with require('gli'), I get the error:

in `require': no such file to load -- gli (LoadError)

even though gem list shows gli (1.6.0).

I don't know exactly how RVM does its gemsets, but there is no gli.rb file in any of the directories in the $LOAD_PATH.

How does RVM interact with the $LOAD_PATH to find the necessary gems in the gemset?

解决方案

Try adding a require 'rubygems' at the top of your source file. In 1.8 rubygems aren't required by default.

Thus said, regarding gem paths:

GEM_HOME indicates where gems are installed. To find out what it is for your case do:

$ echo $GEM_HOME

This should display an RVM-related path, since RVM changes this environment variable in order to make the $ gem install command install gems in its directories.

这篇关于RVM红宝石如何找到宝石?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆