Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Nokogiri Gem for Windows

I'm having this problem with nokogiri's gem:

Could not open library 'C:\Ruby187\lib\ruby\gems\1.8\gems\nokogiri-1.4.6-x86-mingw32\ext\nokogiri\libxml2.dll' : unknown

I read that I had to try the 1.5.0.beta3 version. However, when I run

C:\Users\t3en4>gem install nokogiri --pre
Fetching: nokogiri-1.5.0.beta.4.gem (100%)
ERROR:  Error installing nokogiri:
        The 'nokogiri' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

What should I do?

like image 418
tiiin4 Avatar asked Jun 23 '11 14:06

tiiin4


People also ask

What is GEM Nokogiri?

The Nokogiri gem is an incredible open-source tool that parses HTML and XML data. It is one of the most widely used gems available, and it can really take your Ruby app to another level for data with its ability to help you intuitively scrape websites.

How do I install a specific version of a gem?

Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.

Is Nokogiri a ruby gem?

One of the best gems for Ruby on Rails is Nokogiri which is a library to deal with XML and HTML documents. The most common use for a parser like Nokogiri is to extract data from structured documents.

How does Nokogiri work?

Nokogiri makes an attempt to determine whether a CSS or XPath selector is being passed in. It's possible to create a selector that fools at or search so occasionally it will misunderstand, which is why we have the more specific versions of the methods.


2 Answers

wow, i found the solution, there is a nokogiri for 64bits

goto rubygems, goto nokogiri gem, and look at the version list!

https://rubygems.org/gems/nokogiri

notice the x64-mingw32 and x86-mingw32 version

took me hours to figure this out... enter image description here

like image 141
James Tan Avatar answered Oct 23 '22 16:10

James Tan


You need DevKit to compile the gem properly.

like image 41
mistagrooves Avatar answered Oct 23 '22 17:10

mistagrooves