Waley Chen
Waley Chen

Reputation: 929

Help Getting Started with Mechanize

I'm new to Ruby and just installed Ruby for Windows. I want to use the mechanize library (https://github.com/tenderlove/mechanize) and so I'm following the guide at https://github.com/tenderlove/mechanize/blob/master/GUIDE.rdoc.

On the Windows cmd line, I installed mechanize by using the cmd "gem install mechanize".

When I run the following code:

require 'rubygems'
require 'mechanize'

agent = Mechanize.new

I get the error:

<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>'

Anybody know what's going on?

Upvotes: 1

Views: 3273

Answers (1)

Thiago Silveira
Thiago Silveira

Reputation: 5133

It seems that some dependencies are missing. Try to install the net-http-digest_auth gem.

gem install net-http-digest_auth

If that solves this problem and another (related) pops up, it's probable that you are missing the net-http-persistent gem. If that's the case, you know what to do! Just install it too.

Upvotes: 3

Related Questions