gpt4 book ai didi

ruby - 新安装的 Ruby gem 没有出现在 $LOAD_PATH 中

转载 作者:数据小太阳 更新时间:2023-10-29 07:57:57 24 4
gpt4 key购买 nike

我使用 MacPorts 来管理我的 Ruby/Rails/Gems 安装。最近在执行 gem install wirble 后,当我启动 irb 实例时 wirble 无法加载。这是输出:

$ irb --simple-prompt
Couldn't load Wirble: no such file to load -- wirble

Wirble gem 没有出现在我的 $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
>>

肯定安装了 gem:

$ gem list |grep -i wirble
wirble (0.1.3)

它位于/opt/local/lib/ruby/gems/1.9.1/gems/wirble-0.1.3/

如何将我安装的这个和 future 的 gem 附加到我的 $LOAD_PATH?

最佳答案

您是否需要 irb 中的 RubyGems?

require 'rubygems'

在需要任何 gem 之前可能是必要的。您也可以将此行放在 ~/.irbrc 中,以便在启动 irb 时自动需要您的 RubyGems。

我不确定为什么您的一些 Gem 在您的加载路径中 —— Gem 通常不会出现在 $: 中。

关于ruby - 新安装的 Ruby gem 没有出现在 $LOAD_PATH 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2936291/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com