Error installing nokogiri: Failed to build gem native extension & libiconv is missing (OSX)

前端 未结 15 1394
无人共我
无人共我 2020-12-07 18:25

I try to clone this repo and run bundle install. The bundle process failed and throw this error:

    ...
    Installing nokogiri 1.6.2.1 with na         


        
相关标签:
15条回答
  • 2020-12-07 19:26

    I had the similar issue. The reason was outdated xcode.

    If you run brew doctor you might see it. Just open AppStore, got to updates tab and update your xcode.

    0 讨论(0)
  • 2020-12-07 19:28

    What worked for me (on macOS Sierra) was a combination of Sam's answer and the following:

    gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 --use-system-libraries
    
    0 讨论(0)
  • 2020-12-07 19:30

    Seems like this is due to nokogiri 1.6.2.1 specific problem.

    I add this inside my Gemfile:

    gem 'nokogiri', '~> 1.6', '>= 1.6.7'
    

    And run bundle update nokogiri and then bundle. Everything now working fine.

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