本文介绍了RVM - 无法使用@global gemset中的宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了RVM的问题。一般来说,我使用项目特定的宝石;然而,最近当我在@global gemset中安装一个gem时,当我在一个特定的项目中工作时它不可用。这里是我试图安装 hpricot gem的一个例子。在安装gem并启动一个新shell后,这是正确的。

  $ rvm使用ruby-1.9.2 
使用/home/bshaver/.rvm/gems/ruby-1.9.2-p180

$宝石名单

***本地GEMS ***

bundler(1.0.12)
hpricot(0.8.4)
rake(0.8.7)

$ rvm use ruby​​-1.9.2@myproject-gems
在gemset中使用/home/bshaver/.rvm/gems/ruby-1.9.2-p180 myproject-gems

$ gem list | grep hpricot

$ rvm info

ruby​​-1.9.2-p180@myproject-gems:

系统:
uname: Linux hawkeye.localdomain 2.6.35.12-88.fc14.x86_64#1 SMP Thu Mar 31 21:21:57 UTC 2011 x86_64 x86_64 x86_64 GNU / Linux
bash:/ bin / bash => GNU bash,版本4.1.7(1)-release(x86_64-redhat-linux-gnu)
zsh:=>未安装

rvm:
version:rvm 1.5.2 by Wayne E. Seguin([email protected])[http://rvm.beginrescueend.com/]

ruby​​:
解释器:ruby
版本:1.9.2p180
日期:2011-02-18
平台:x86_64-linux
patchlevel:2011-02-18 revision 30909
full_version:ruby 1.9.2p180(2011-02-18 revision 30909)[x86_64-linux]

homes:
gem:/home/bshaver/.rvm/gems/ ruby-1.9.2-p180@myproject-gems
ruby​​:/home/bshaver/.rvm/rubies/ruby-1.9.2-p180

二进制文件:
ruby​​:/home/bshaver/.rvm/rubies/rub y-1.9.2-p180 / bin / ruby​​
irb:/home/bshaver/.rvm/rubies/ruby-1.9.2-p180/bin/irb
gem:/ home /bshaver/.rvm/rubies/ruby-1.9.2-p180/bin/gem
rake:/home/bshaver/.rvm/gems/ruby-1.9.2-p180@global/bin/rake

环境:
路径:/home/bshaver/.rvm/gems/ruby-1.9.2-p180@myproject-gems/bin:/home/bshaver/.rvm/ gems/ruby-1.9.2-p180@global/bin:/home/bshaver/.rvm/rubies/ruby-1.9.2-p180/bin:/home/bshaver/.rvm/bin:在/ usr /本地/ JAVA /bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin :/ opt / real / RealPlayer /:/ home / bshaver / bin:/ home / bshaver / test-root / bin:/ home / bshaver / Documents / scripts /
GEM_HOME:/ home / bshaver /。 rvm/gems/ruby-1.9.2-p180@myproject-gems

GEM_PATH:/home/bshaver/.rvm/gems/ruby-1.9.2-p180@myproject-gems:/ home/bshaver/.rvm/gems/ruby-1.9.2-p180@global
MY_RUBY_HOME:/home/bshaver/.rvm/rubies/ruby-1.9.2-p180
IRBRC: /home/bshaver/.rvm/rub ies / ruby​​-1.9.2-p180 / .irbrc
RUBYOPT:
gemset:myproject-gems

为什么 hpricot 在项目gemset中不可用?我确实也遇到了与 bundler 相同的问题,但最终再次将其安装在gemset中。



谢谢..

解决方案

这里的问题是,第一次安装hpricot gem时,我没有使用 @global gemset。



解释器的默认gemset与该解释器的 @global gemset有所不同。



所以你可以通过

  $ rvm来实现所需的结果use ruby​​-1.9.2@global 
使用/home/bshaver/.rvm/gems/ruby-1.9.2-p180和gemset global

$ gem install validation_refelection
获取:validation_reflection-1.0.0.gem(100% )
已成功安装validation_reflection-1.0.0
1已安装gem
为validation_reflection-1.0.0安装ri文档...
为validation_reflection-1.0.0安装RDoc文档.. 。

$ rvm use ruby​​-1.9.2@myproject-gems
使用/home/bshaver/.rvm/gems/ruby-1.9.2-p180和gemset myproject-gems

$ gem list | grep validation_reflection
validation_reflection(1.0.0)

该项目可以使用gem希望。

I'm having an issue with RVM. In general I use project specific gemsets; however, recently when I install a gem into the @global gemset, it is not available when I'm working in a particular project. Here is an example where I was trying to install the hpricot gem. This is right after installing the gem and starting a fresh shell.

$ rvm use ruby-1.9.2
Using /home/bshaver/.rvm/gems/ruby-1.9.2-p180

$ gem list

*** LOCAL GEMS ***

bundler (1.0.12)
hpricot (0.8.4)
rake (0.8.7)

$ rvm use ruby-1.9.2@myproject-gems
Using /home/bshaver/.rvm/gems/ruby-1.9.2-p180 with gemset myproject-gems

$ gem list | grep hpricot

$ rvm info

ruby-1.9.2-p180@myproject-gems:

  system:
uname:       "Linux hawkeye.localdomain 2.6.35.12-88.fc14.x86_64 #1 SMP Thu Mar 31 21:21:57 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux"
bash:        "/bin/bash => GNU bash, version 4.1.7(1)-release (x86_64-redhat-linux-gnu)"
zsh:         " => not installed"

  rvm:
version:      "rvm 1.5.2 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]"

  ruby:
interpreter:  "ruby"
version:      "1.9.2p180"
date:         "2011-02-18"
platform:     "x86_64-linux"
patchlevel:   "2011-02-18 revision 30909"
full_version: "ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]"

  homes:
gem:          "/home/bshaver/.rvm/gems/ruby-1.9.2-p180@myproject-gems"
ruby:         "/home/bshaver/.rvm/rubies/ruby-1.9.2-p180"

  binaries:
ruby:         "/home/bshaver/.rvm/rubies/ruby-1.9.2-p180/bin/ruby"
irb:          "/home/bshaver/.rvm/rubies/ruby-1.9.2-p180/bin/irb"
gem:          "/home/bshaver/.rvm/rubies/ruby-1.9.2-p180/bin/gem"
rake:         "/home/bshaver/.rvm/gems/ruby-1.9.2-p180@global/bin/rake"

  environment:
PATH:         "/home/bshaver/.rvm/gems/ruby-1.9.2-p180@myproject-gems/bin:/home/bshaver/.rvm/gems/ruby-1.9.2-p180@global/bin:/home/bshaver/.rvm/rubies/ruby-1.9.2-p180/bin:/home/bshaver/.rvm/bin:/usr/local/java/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/real/RealPlayer/:/home/bshaver/bin:/home/bshaver/test-root/bin:/home/bshaver/Documents/scripts/"
GEM_HOME:     "/home/bshaver/.rvm/gems/ruby-1.9.2-p180@myproject-gems"

GEM_PATH:     "/home/bshaver/.rvm/gems/ruby-1.9.2-p180@myproject-gems:/home/bshaver/.rvm/gems/ruby-1.9.2-p180@global"
MY_RUBY_HOME: "/home/bshaver/.rvm/rubies/ruby-1.9.2-p180"
IRBRC:        "/home/bshaver/.rvm/rubies/ruby-1.9.2-p180/.irbrc"
RUBYOPT:      ""
gemset:       "myproject-gems"

Any ideas why hpricot would not be available inside of the project gemset? I did have the same issue with bundler as well, but ended up installing it again in the gemset.

Thanks..

解决方案

The problem here is that I wasn't using the @global gemset when installing hpricot gem the first time.

There is a difference between the interpreter's default gemset and the @global gemset for that interpreter.

So you can achieve the desired result by

$ rvm use ruby-1.9.2@global
Using /home/bshaver/.rvm/gems/ruby-1.9.2-p180 with gemset global

$ gem install validation_refelection
Fetching: validation_reflection-1.0.0.gem (100%)
Successfully installed validation_reflection-1.0.0
1 gem installed
Installing ri documentation for validation_reflection-1.0.0...
Installing RDoc documentation for validation_reflection-1.0.0...

$ rvm use ruby-1.9.2@myproject-gems
Using /home/bshaver/.rvm/gems/ruby-1.9.2-p180 with gemset myproject-gems

$ gem list | grep validation_reflection
validation_reflection (1.0.0)

And the gem is available to the project as desired.

这篇关于RVM - 无法使用@global gemset中的宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 18:09