1

我在加载 hpricot gem 时遇到问题。我在 rake 任务中使用它并放入require "hpricot"其中。但它不会加载错误消息:no such file to load -- hpricot 但我会在我的 gem 列表中看到它,但不知道为什么 rake 任务无法识别它。有人对 hpricot gem 的这种问题有经验吗?

输出gem list -d hpricot

*** LOCAL GEMS ***

hpricot (0.8.3)
   Author: why the lucky stiff
   Rubyforge: http://rubyforge.org/projects/hobix
   Homepage: http://code.whytheluckystiff.net/hpricot/
   Installed at: /Library/Ruby/Gems/1.8

   a swift, liberal HTML parser with a fantastic lib
4

2 回答 2

1

我解决了这个问题。我忘记将 hpricot gem 添加到我的 rails 应用程序的 gem 文件中。在我将 gem 添加到 gemfile 并运行之后bundle install,一切正常。

于 2011-02-05T13:46:25.747 回答
0

require 'rubygems'请在要求 hpricot 之前尝试添加。

于 2011-01-29T20:29:26.460 回答