RVM-无法使用来自@global gemset的宝石。[英] RVM - Not able to use gems from the @global gemset

本文是小编为大家收集整理的关于RVM-无法使用来自@global gemset的宝石。的处理方法,想解了RVM-无法使用来自@global gemset的宝石。的问题怎么解决?RVM-无法使用来自@global gemset的宝石。问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

我遇到了关于 RVM 的问题.一般来说,我使用项目特定的 gemsets;但是,最近当我将 gem 安装到 @global gemset 中时,当我在特定项目中工作时它不可用.这是我尝试安装 hpricot gem 的示例.这是在安装 gem 并启动新的 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 (wayneeseguin@gmail.com) [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"

知道为什么 hpricot 在项目 gemset 中不可用吗?bundler 我也遇到了同样的问题,但最终在 gemset 中再次安装了它.

谢谢..

推荐答案

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

解释器的默认 gemset 与该解释器的 @global gemset 之间存在差异.

所以你可以通过

达到想要的结果
$ 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)

并且 gem 可以根据需要用于项目.

本文地址:https://www.itbaoku.cn/post/786338.html