使用RVM安装Ruby后,全局gemset不可见

时间:2012-10-31 17:46:43

标签: ruby gem rvm gemset

我按照通常的方式安装了RVM:

curl -L https://get.rvm.io | bash -s stable --ruby

在安装过程中会显示以下消息:

ruby-1.9.3-p286 - #configure
ruby-1.9.3-p286 - #download
(...)
ruby-1.9.3-p286 - #extract
ruby-1.9.3-p286 - #validate
ruby-1.9.3-p286 - #setup
'ruby' was not found, cannot install rubygems unless ruby is present (Do you have an RVM ruby installed & selected?)
Saving wrappers to '/home/rmaruszewski/.rvm/bin'.
ruby-1.9.3-p286 - #importing default gemsets (/home/rmaruszewski/.rvm/gemsets/)
Creating alias default for ruby-1.9.3-p286.
Recording alias default for ruby-1.9.3-p286.
Creating default links/files
Saving wrappers to '/home/rmaruszewski/.rvm/bin'.

“'红宝石'未找到”消息是可疑的......

而且,当我拨打gem list时,列表为空。

*** LOCAL GEMS ***

然后我致电rvm use ruby@global然后gem list,我得到:

*** LOCAL GEMS ***

bundler (1.2.1)
rake (0.9.2.2)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)

所以,显然,我的“全局”gemset在“默认”gemset中是看不到的。你能告诉我为什么吗?

以下是“global”gemset的rvm info输出:

ruby-1.9.3-p286@global:

  system:
    uname:       "Linux rmaruszewski 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux"
    system:      "ubuntu/12.04/x86_64"
    bash:        "/bin/bash => GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.16.17 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "12 minutes 37 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p286"
    date:         "2012-10-12"
    platform:     "x86_64-linux"
    patchlevel:   "2012-10-12 revision 37165"
    full_version: "ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]"

  homes:
    gem:          "/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286@global"
    ruby:         "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286"

  binaries:
    ruby:         "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286/bin/ruby"
    irb:          "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286/bin/irb"
    gem:          "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286/bin/gem"
    rake:         "/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286@global/bin/rake"

  environment:
    PATH:         "/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286@global/bin:/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286/bin:/home/rmaruszewski/.rvm/bin:/home/rmaruszewski/bin:/home/rmaruszewski/bin/build:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt:/opt/AccurevTools/bin:/opt/accurev/bin:/home/rmaruszewski/bin/gitscripts:/srv/git/development/tools/gts/bin:/srv/git/build/Build:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin:/opt/grails/bin:/opt/gradle/bin"
    GEM_HOME:     "/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286@global"
    GEM_PATH:     "/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286@global"
    MY_RUBY_HOME: "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286"
    IRBRC:        "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286/.irbrc"
    RUBYOPT:      ""
    gemset:       "global"

这是针对“默认”宝石集:

ruby-1.9.3-p286:

  system:
    uname:       "Linux rmaruszewski 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux"
    system:      "ubuntu/12.04/x86_64"
    bash:        "/bin/bash => GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.16.17 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "18 minutes 26 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p286"
    date:         "2012-10-12"
    platform:     "x86_64-linux"
    patchlevel:   "2012-10-12 revision 37165"
    full_version: "ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]"

  homes:
    gem:          "/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286"
    ruby:         "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286"

  binaries:
    ruby:         "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286/bin/ruby"
    irb:          "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286/bin/irb"
    gem:          "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286/bin/gem"
    rake:         "/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286@global/bin/rake"

  environment:
    PATH:         "/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286/bin:/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286@global/bin:/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286/bin:/home/rmaruszewski/.rvm/bin:/home/rmaruszewski/bin:/home/rmaruszewski/bin/build:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt:/opt/AccurevTools/bin:/opt/accurev/bin:/home/rmaruszewski/bin/gitscripts:/srv/git/development/tools/gts/bin:/srv/git/build/Build:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin:/opt/grails/bin:/opt/gradle/bin"
    GEM_HOME:     "/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286"
    GEM_PATH:     "/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286:/home/rmaruszewski/.rvm/gems/ruby-1.9.3-p286@global"
    MY_RUBY_HOME: "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286"
    IRBRC:        "/home/rmaruszewski/.rvm/rubies/ruby-1.9.3-p286/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

2 个答案:

答案 0 :(得分:2)

我认为除了Mac OSX 10.7之外我遇到了同样的问题。

我是红宝石的新手。我正在浏览netuts教程(http://net.tutsplus.com/tutorials/ruby/singing-with-sinatra-the-recall-app-2/)。

我安装了RVM,升级到最新的Ruby(mac自带1.8.7),设置rvm默认为1.9.3,gem安装了sinatra,datamapper等,但当我尝试在任何一个中要求“datamapper”时IRB或.rb文件,我得到“LoadError:无法加载此类文件 - datamapper”错误。

我在gem上安装了data_mapper,这似乎有效,但是,这似乎是我不理解的某种配置问题。

我发帖是因为我看到了与RVM(1.16.17)和ruby(1.9.3-p286)相同的版本,我的宝石列表中有相同的RVM版本--local(rvm 1.11.3.5) )。

不确定我如何拥有RVM 1.16.17并且gem说rvm 1.11.3.5。此外,rubygems应该在1.9中被“包含”,但在irb中如果我输入需要“rubygems”则返回false。

我讨厌成为一个n00b ...抱歉,我没有答案。

答案 1 :(得分:1)

你是否首先使用了红宝石:

rvm use ruby