我是Ruby新手,刚刚安装了Ruby for Windows。我想使用机械化库(https://github.com/tenderlove/mechanize),所以我遵循了https://github.com/tenderlove/mechanize/blob/master/GUIDE.rdoc的指南。
在Windows cmd行上,我使用cmd "gem install mechanize“安装了mechanize。
当我运行以下代码时:
require 'rubygems'
require 'mechanize'
agent = Mechanize.new我得到了错误:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- net/http/digest_auth (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Ruby192/lib/ruby/1.9.1/mechanize.rb:5:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from helloworld.rb:2:in `<main>'有人知道这是怎么回事吗?
发布于 2011-06-26 20:04:45
似乎缺少一些依赖项。尝试安装net-http-digest_auth gem。
gem安装net-http-digest_auth
如果这解决了这个问题,并且弹出了另一个(相关的),那么您很可能错过了net-http-persistent的精华。如果是这样的话,你知道该怎么做!只需安装它即可。
https://stackoverflow.com/questions/6482204
复制相似问题