ワナビーエンジニアのブログ

なんでもいいから文化的な生活を送りたい

win8にnokogiri

握手会のアレで最近nokogiriが話題ですね。

さてHTMLをスクレイピングしたくて
Windows8にgemのnokogiriをインストールしようとして苦戦しました。
#Win7ならすんなり入るのに・・・


公式NokogiriのInstallationをみると、

Luckily for you, building on Windows is so difficult that we’ve done it for you: 
Nokogiri comes bundled with all the DLLs you need to be NOKOGIRIFIED!

とか。できねーよ!!!!


んまあ、libxml2とlibxsltが無いというエラーがでます。

上記2つを手動でダウンロードしたり、

    • with-xml2-lib=/hogehoge

とかいろいろ指定したりしてましたが、全くできなかった。。

翌日、

gem install nokogiri --pre -- --with-xml2-lib --with-xslt-lib --platform=ruby

あたりでよくわかりませんが何故かとおりました。 #一番ダメなやつ