新安装的 Ruby gem 未显示在 $LOAD_PATH 中
我使用 MacPorts 来管理我的 Ruby/Rails/Gems 安装。最近,在执行gem install wirble
之后,当我启动 irb 实例时,wirble 无法加载。输出如下:
$ irb --simple-prompt
Couldn't load Wirble: no such file to load -- wirble
The Wirble gem does not show up in my $LOAD_PATH:
>> puts $:
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionmailer-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activeresource-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/ext
/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-1.0.1/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-1.0.1/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rails-2.3.5/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rails-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygems-update-1.3.7/hide_lib_for_update
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygems-update-1.3.7/bin
/opt/local/lib/ruby1.9/site_ruby/1.9.1
/opt/local/lib/ruby1.9/site_ruby/1.9.1/i386-darwin10
/opt/local/lib/ruby1.9/site_ruby
/opt/local/lib/ruby1.9/vendor_ruby/1.9.1
/opt/local/lib/ruby1.9/vendor_ruby/1.9.1/i386-darwin10
/opt/local/lib/ruby1.9/vendor_ruby
/opt/local/lib/ruby1.9/1.9.1
/opt/local/lib/ruby1.9/1.9.1/i386-darwin10
.
=> nil
>>
The gem is Absolutely Install:
$ gem list |grep -i wirble
wirble (0.1.3)
It is located in /opt/local/lib/ruby/gems/1.9.1/gems/wirble-0.1 .3/
如何将我安装的这个和未来的 gem 附加到我的 $LOAD_PATH 中?
I'm using MacPorts in order to manage my Ruby/Rails/Gems installations. Recently after doing a gem install wirble
, wirble fails to load when I start an instance of irb. Here's the output:
$ irb --simple-prompt
Couldn't load Wirble: no such file to load -- wirble
The Wirble gem doesn't show up in my $LOAD_PATH:
>> puts $:
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionmailer-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activeresource-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/ext
/opt/local/lib/ruby1.9/gems/1.9.1/gems/mysql-2.8.1/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-1.0.1/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-1.0.1/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rails-2.3.5/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rails-2.3.5/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/bin
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygems-update-1.3.7/hide_lib_for_update
/opt/local/lib/ruby1.9/gems/1.9.1/gems/rubygems-update-1.3.7/bin
/opt/local/lib/ruby1.9/site_ruby/1.9.1
/opt/local/lib/ruby1.9/site_ruby/1.9.1/i386-darwin10
/opt/local/lib/ruby1.9/site_ruby
/opt/local/lib/ruby1.9/vendor_ruby/1.9.1
/opt/local/lib/ruby1.9/vendor_ruby/1.9.1/i386-darwin10
/opt/local/lib/ruby1.9/vendor_ruby
/opt/local/lib/ruby1.9/1.9.1
/opt/local/lib/ruby1.9/1.9.1/i386-darwin10
.
=> nil
>>
The gem is definitely installed:
$ gem list |grep -i wirble
wirble (0.1.3)
It is located in /opt/local/lib/ruby/gems/1.9.1/gems/wirble-0.1.3/
How do I get this and future gems I installed appended to my $LOAD_PATH?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您在 irb 中需要 RubyGems 吗?
在需要任何宝石之前可能是必要的。您还可以将此行放在
~/.irbrc
中,以便在 irb 启动时自动需要 RubyGems。我不确定为什么您的某些 Gem 会出现在您的加载路径中 - Gem 通常不会出现在
$:
中。Did you require RubyGems in irb?
will probably be necessary before requiring any gems. You can also put this line in
~/.irbrc
so you RubyGems will automatically be required when irb is started up.I'm not sure why some of your Gems are in your load path -- gems usually don't appear in
$:
.我让这个工作!
使用此版本: https://github.com/blackwinter/wirble.git 并且成功了!
希望有帮助!
约翰
I got this to work!
Used this version: https://github.com/blackwinter/wirble.git and it worked!
Hope that helps!
John