试图在Ubuntu 10.10上运行mongo3 gem。救命!

时间:2011-02-01 04:38:41

标签: ruby ubuntu rubygems gem

我正在尝试运行ruby gem“mongo3”(http://mongo3.com/)

我是gem的新手,但我会认为运行“gem mongo3”应该执行它,但是我收到了这个错误:

chris@Zombie:~$ gem mongo3
ERROR:  While executing gem ... (RuntimeError)
    Unknown command mongo3

所以我做了“gem mongo3”,它说它位于“/var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb”。然后我运行了“ruby /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb”,结果如下:

chris@Zombie:~$ ruby /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb
/var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3/node.rb:1:in `require': no such file to load -- json (LoadError)
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3/node.rb:1
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `require'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `require_all_libs_relative_to'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `each'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `require_all_libs_relative_to'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:53

我不确定我做错了什么 - 我怀疑红宝石和宝石对宝石的加载位置或其他东西感到困惑。谢谢!

1 个答案:

答案 0 :(得分:1)

您无需执行gem mongo3ruby /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb。相反,只需运行mongo3

请务必按照使用说明here进行配置,否则会出现运行时错误。

修改:如果您未使用sudo安装gem,则您将无权使用/usr/bin的正确写入权限,这意味着mongo3可执行文件不在您的路径中。安装时你可能会看到这样的警告:

WARNING:  Installing to ~/.gem since /var/lib/gems/1.8 and 
          /usr/bin aren't both writable.
WARNING:  You don't have /home/chris/.gem/ruby/1.8/bin in your PATH, 
          gem executables will not run.

您有两种选择:使用sudo gem install mongo3安装gem,以便正确链接到/usr/bin,或将/home/chris/.gem/ruby/1.8/bin添加到您的路径中。