Nokogiri installation fails -libxml2 is missing

前端 未结 19 2547
情书的邮戳
情书的邮戳 2020-11-27 10:22

I always worked my way around Nokogiri installation issues by following the documentation in the \"Installing Nokogiri\" tutorial.

But this time, even after installi

19条回答
  •  借酒劲吻你
    2020-11-27 10:42

    I just had the same issue on Fedora 13. After a frustrating and unsuccessful search to make

    gem install nokogiri
    

    work for me, I was able to install it and get around the libxml2 error via yum.

    Simply install the gem via yum instead of the gem command:

    su
    yum search rubygem-nokogiri   #this find the proper package name
    yum install rubygem-nokogiri.i686
    

    This helped me find the right answer for Fedora and, as I am using RVM for Ruby package management,

    yum install rubygem-nokogiri
    

    will pull in all the Ruby gems and dependencies into the system, not into my RVM environment, and in my experience that leads to a very frustrating and humbling experience.

    So, taking your find of the Nokogiri yum gem you can use:

    yum provides  rubygem-nokogiri
    

    and get a list of the dependencies for rubygem-Nokogiri which showed me the libraries that were missing. After that I ran:

    yum install libxml2-devel libxslt libxslt-devel
    

    Now Nokogiri compiles in Fedora and Nokogiri installs. D'oh!, we need the headers to compile Nokogiri from the devel libraries.

提交回复
热议问题