Failing to install Nokogiri gem

后端 未结 12 1082
感情败类
感情败类 2020-12-30 03:30

I\'m working on a rails app that allows for image attachments to each use account. I\'m using paperclip and amazon web services:

gem \'paperclip\'
gem \'aws-         


        
相关标签:
12条回答
  • 2020-12-30 04:15

    Have you tried gem install nokogiri -v 1.6.5 -- --use-system-libraries?Most nokogiri errors are to do with libxml2, libxslt or libiconv config.

    Nokogiri docs should give you more instructions. If the solution doesn't work, you may want to post full stack trace so others can help more.

    0 讨论(0)
  • 2020-12-30 04:15

    To take from dylanjhunt's awesome answer on Github, just in case anyone hasn't tried it,

    Just to add to this, I was having a very similar issue that was resolved by updating dev tools.

    xcode-select --install

    Hoping someone sees this that had not tried doing this yet and it helps.

    0 讨论(0)
  • 2020-12-30 04:16

    after upgrading to Rails 4.2.4 (which inculdes Nokogiri 1.6.6.2) on Ubuntu 14.04 (I'm using RVM) I needed to do this:

    sudo apt-get install libgmp-dev
    

    or

    sudo apt-get install libgmp3-dev
    
    0 讨论(0)
  • 2020-12-30 04:18

    Package that did it:

    apt-get install libghc-zlib-dev
    

    Other possible candidate:

    zlib1g-dev on 12.04

    found it here

    0 讨论(0)
  • 2020-12-30 04:22

    I solved this by installing the xcode dependencies that Nokogiri needs to be installed:

    xcode-select --install
    

    After that run bundle install again and it should work.

    0 讨论(0)
  • 2020-12-30 04:23

    I didn't get the same error message as you, but I wanted to note what I finally found as the extraordinarily simple solution for installing nokogiri on Ubuntu:

    Turns out the nokogiri build process depends on patch.

    Run: sudo apt-get install patch

    I was working on a VM (a vagrant box, actually), which is why I didn't already have patch installed.

    The error I got (after a lot of other stuff that looked like an error but was actually just a warning) was:

    Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.2... OK
    Running patch with /var/lib/gems/1.9.1/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
    Running 'patch' for libxml2 2.9.2... ERROR, review '/var/lib/gems/1.9.1/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.2/patch.log' to see what happened.
    

    I've deleted the log by now (the above was in my terminal session), but the patch.log file referenced above was absurdly simple; it just said something like patch not found.

    Boy did I feel silly for all the digging around I did installing libraries trying to fix it! :)

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