加载 hpricot gem 时出现问题
我在加载 hpricot gem 时遇到问题。 我在 rake 任务中使用它,并在其中放入 require "hpricot"
。 但它不会加载并显示错误消息:no such file to load -- hpricot
但我会在我的宝石列表中看到它,但不知道为什么 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
I have a problem with loading the hpricot gem.
I'm using it in a rake task and put a require "hpricot"
in it.
But it doesn't load with a error message:no such file to load -- hpricot
But I'll see it in my gem list but don't know why the rake task doesn't recognize it.
Does anybody has experience with that kind of problem with the hpricot gem?
output of 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我解决了这个问题。
我忘记将 hpricot gem 添加到我的 Rails 应用程序的 gem 文件中。
将 gem 添加到 gemfile 并运行
bundle install
后,一切正常。I solved the problem.
I forgot to add the hpricot gem to the gem file of my rails app.
After I added the gem to the gemfile and ran a
bundle install
, everything works fine.请尝试在 require hpricot 之前添加
require 'rubygems'
。Please try to add
require 'rubygems'
before requiring hpricot.