nokogiri - ERROR: Failed to build gem native extension

前端 未结 8 1314
既然无缘
既然无缘 2020-12-11 15:59

I updated to the developer release of Lion and noticed I couldn\'t start rails apps anymore. Whenever I try to sudo bundle install, I get the following error:

相关标签:
8条回答
  • 2020-12-11 16:25

    Install the ruby1.8-dev gem (or rather, the applicable *-dev gem), which will include all the header files. See: This question

    0 讨论(0)
  • 2020-12-11 16:31

    I had similar problem, and after installing XCode 4.1, I also had to do the following command:

    sudo port upgrade libxml2 libxslt
    

    After that Nokogiri built without problems.

    More info: http://tektastic.com/2011/07/ruby-mac-ports-and-os-x-lion.html

    0 讨论(0)
  • 2020-12-11 16:33

    I found this worked via https://github.com/sparklemotion/nokogiri/issues/1166#issuecomment-56545974.

    $ brew install libxml2
    $ gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
    

    Here's a more detailed approach if even this doesn't work. http://www.bullrico.com/2012/07/12/installing-nokogiri-after-updating-homebrew

    0 讨论(0)
  • 2020-12-11 16:33

    It says: "can't find header files for ruby". In other words, you're missing the ruby headers in order to compile libxml/nokogiri as a ruby extension.

    Consider installing ruby 1.9 (or 1.8) using macports or rvm. I'm not 100% on the second, but the first will automatically make the relevant headers available.

    0 讨论(0)
  • 2020-12-11 16:33

    Consider installing a pre-1.6 version of nokigiri (gem install nokogiri -v '1.5.9')

    0 讨论(0)
  • 2020-12-11 16:37

    Try to install "libxslt1-dev" and "libxml2-dev" packages.

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