Nokogiri installation fails -libxml2 is missing

前端 未结 19 2315
情书的邮戳
情书的邮戳 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:44

    At macOS none of above/below had really worked for me until I explicitly provided XCode libxml2 path to --with-xml2-include.

    gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2 --use-system-libraries
    
    0 讨论(0)
  • 2020-11-27 10:45

    For OSX users, if you've had success installing Nokogiri before, yet are getting errors installing it on, say, using a new version of Ruby that you've added and that error that includes a message like:

    The compiler failed to generate an executable file. (RuntimeError)
    You have to install development tools first.
    

    This could be indicative of a XCode upgrade having happened via the App Store, either manually or automatically, and you not having opened it since that time.

    If so, you should be able to open XCode, agree to the new license, and then install Nokogiri successfully.

    0 讨论(0)
  • 2020-11-27 10:45

    Was able to install vagrant-awe by following the above post but using the command as follow:

    NOKOGIRI_USE_SYSTEM_LIBRARIES=1 vagrant plugin install vagrant-aws
    
    0 讨论(0)
  • 2020-11-27 10:46

    You usually need development files for building gems. Try:

    sudo apt-get install libxslt-dev libxml2-dev
    

    (I just saw that Eric suggested the same in a comment.)

    0 讨论(0)
  • 2020-11-27 10:48

    You may actually need to install both of these packages

    sudo apt-get install libxslt-dev libxml2-dev
    
    0 讨论(0)
  • 2020-11-27 10:50

    I was able to install Nokogiri 1.6.5 on Fedora 20 by doing:

    export NOKOGIRI_USE_SYSTEM_LIBRARIES=true
    

    Then running:

    gem install nokogiri
    
    0 讨论(0)
提交回复
热议问题