Mac user and getting WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3

前端 未结 16 1564
暖寄归人
暖寄归人 2020-11-27 11:24

I have done all kinds of research and tried many different things. I know this question has been answered many times, but none of the suggested solutions are working for me.

16条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 12:10

    gem uninstall nokogiri
    bundle  #install nokogiri again
    

    If that fails with "libxml2 is missing." and you see gems/nokogiri-1.5.0/ext/nokogiri/mkmf.log trying to use "/usr/bin/gcc-4.2 ...", then you're missing /usr/bin/gcc-4.2

    Solution:

    sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
    

    Before:

    $ ll /usr/bin/gcc*
    lrwxr-xr-x  1 root  wheel  12 Jan 15 00:16 /usr/bin/gcc -> llvm-gcc-4.2
    

    After:

    $ ll /usr/bin/gcc*
    lrwxr-xr-x  1 root  wheel  12 Jan 15 00:16 /usr/bin/gcc -> llvm-gcc-4.2
    lrwxr-xr-x  1 root  wheel  12 Jan 15 21:07 /usr/bin/gcc-4.2 -> /usr/bin/gcc
    

    If you're really missing libxml2 libxslt, then

    brew update
    brew install libxml2 libxslt
    brew link libxml2 libxslt
    bundle config build.nokogiri --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2/ --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib/ --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
    bundle
    

    FYI: I'm running Mountain Lion with brew, and bundler.

提交回复
热议问题