安装在@global gemset中的Gem在其他gemset中不可用



我先安装了rvm,然后在@global gemset中安装了bropages

$ rvm install 2.2.3
$ rvm use ruby-2.2.3@global
$ gem install bropages

运行

$ gem list | grep bro
bropages (0.1.0)

我可以看到浏览器安装。但是,当我移动到默认gemset时,它是不可用的。

$ rvm use ruby-2.2.3@default
$ gem list | grep bro # Result is empty

我也试过官方的方式。

$ rvm ruby-2.2.3@global do gem install bropages
Successfully installed bropages-0.1.0
Parsing documentation for bropages-0.1.0
Done installing documentation for bropages after 0 seconds
1 gem installed

但也没有成功。

在默认的gemset中运行bro命令会出现这个错误,

$ bro
/Users/andy/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'bropages' (>= 0) among 7 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/andy/.rvm/gems/ruby-2.2.3 /Users/andy/.rvm/gems/ruby-2.2.3@global:/Users/andy/.rvm/gems/ruby-2.2.3', execute `gem env` for more information
    from /Users/andy/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
    from /Users/andy/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /Users/andy/.rvm/gems/ruby-2.2.3@global/bin/bro:22:in `<main>'

我试过这些链接,但它们根本没有帮助。

  1. 如何在使用RVM时跨所有gemset安装gem
  2. RVM -无法使用@global gemset
  3. 中的gem
  4. 如何使用RVM创建全局可用的gem ?

Ruby 2.2.3是唯一安装的版本。我的壳是鱼。


从评论

从默认gemset运行:echo $GEM_HOME - $GEM_PATH从全局gemset run: gem list -d bro

输出如下,

$ rvm use ruby-2.2.3@default
Using /Users/andy/.rvm/gems/ruby-2.2.3
$ echo $GEM_HOME - $GEM_PATH
/Users/andy/.rvm/gems/ruby-2.2.3 - /Users/andy/.rvm/gems/ruby-2.2.3 /Users/andy/.rvm/gems/ruby-2.2.3@global
$ rvm use ruby-2.2.3@global
Using /Users/andy/.rvm/gems/ruby-2.2.3 with gemset global
$ gem list -d bro
*** LOCAL GEMS ***
bropages (0.1.0)
    Author: bropages.org
    Homepage: http://bropages.org
    Installed at: /Users/andy/.rvm/gems/ruby-2.2.3@global
    Bro

看起来你的GEM_PATH坏了,请运行:

export GEM_PATH=/Users/andy/.rvm/gems/ruby-2.2.3:/Users/andy/.rvm/gems/ruby-2.2.3@global

和重试:

bro

相关内容

  • 没有找到相关文章

最新更新