Load Error Using Mechanize Gem


I’m getting a “Could not open any of [xml2, xslt, exslt] (LoadError)” error when trying to run a simple Ruby program taken from the EXAMPLES.rdoc file of the Mechanize gem.

The error is in this line of the Nokogiri module of libxml.rb: ffi_lib ‘xml2’, ‘xslt’, ‘exslt’

Not sure if there are missing gems, and if so, what to install. Any ideas how to fix this?

Thanks very much.

Gary M.

Program – main.rb:

Hi I am assuming things here because you are on Jruby and windows

But you do require those libraries. Nokogiri in particular needs the latest version of LibXml2 and you can run nokogiri -v on your terminal to see if it has been built with the latest version of libxml and the libxml2.dll is in the corrent load path.

However I found this on the tenderlove wiki github its a known issue and someone has sugested a workaround for windows:


quote "I solved the problem and record them here:

Make sure do not use libxml2 or libxslt, you should use libexslt. Good luck. "

I hope that helps