Failing to install Nokogiri gem

后端 未结 12 1081
感情败类
感情败类 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:01

    install gcc first

    in *buntu : apt-get install gcc

    after that U may requer most dev libs, such as libxml2 / zlib / etc. see build log(path in my case) : /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8.1/mkmf.log for string like - fatal error: zlib.h: No such file or directory

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

    On Ubuntu, try installing the following dependencies:

    sudo apt-get install gcc ruby-dev libxslt-dev libxml2-dev zlib1g-dev
    
    0 讨论(0)
  • 2020-12-30 04:03

    Since the OP was referencing bundle install which I happened to use as well I think it is worth pointing out the Installing Nokogiri page which eventually revealed the most elegant solution (which worked for me also on Mac OS X 10.8.5):

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

    This instructs bundler to install nokogiri as in the answers of @kasperite

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

    I had the same issue earlier today. I had updated my xcode and had not agreed to the terms yet. Running sudo xcodebuild -license and agreeing got my bundle working again.

    • https://github.com/CocoaPods/CocoaPods/issues/1727#issuecomment-194568428
    0 讨论(0)
  • 2020-12-30 04:11

    As per the nokogiri installation instruction installing,

    sudo apt-get install zlib1g-dev

    solved the issue for me.

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

    This works like a charm!

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

    https://stackoverflow.com/a/24511149

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