nokogiri gem installation error

后端 未结 17 777
庸人自扰
庸人自扰 2020-11-30 21:04

I know there are a lot of questions about this gem but no answer has worked for me.

When I run in SSH gem install nokogiri I get this error:

<         


        
相关标签:
17条回答
  • 2020-11-30 21:52

    Just Like wongzigii says the install command works with those flags with macOS Sierra

    gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2/

    0 讨论(0)
  • 2020-11-30 21:58

    I ran into this same problem, because of an unlisted build dependency. When I found the tmp directory in question:

    find ~/.rbenv/ -name patch.log
    

    It said:

    sh: patch: command not found

    Fixed that with a simple:

    sudo yum install -y patch
    
    0 讨论(0)
  • 2020-11-30 21:59

    Am using macOS Sierra.

    Went to nokogiri documentation and followed this:

    ON MAC OSX

    Installation should Just Work™ using Nokogiri’s vendored libxml2 and libxslt.

    First, make sure you have the latest version of RubyGems and xcode commandline tools:

    1 gem update --system

    2 xcode-select --install

    Then install nokogiri:

    1 gem install nokogiri

    0 讨论(0)
  • 2020-11-30 22:01

    Nothing in current answers worked for me (I use Ubuntu 16.04, not Mac).

    However, by following the instructions in Nokogiri site and this part did the trick:

    # See http://www.nokogiri.org/tutorials/installing_nokogiri.html#ubuntu___debian
    sudo apt-get install build-essential patch
    sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
    

    Note I've been using Nokogiri since 2009 and I've always had trouble installing it. Any further comment would probably not comply with SO T&Cs :)

    0 讨论(0)
  • 2020-11-30 22:01

    step 1:

    brew install libxml2
    

    Step 2:

    bundle config build.nokogiri --use-system-libraries
    

    Step 3: then try

    bundle install

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