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

前端 未结 16 1599
暖寄归人
暖寄归人 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:05

    To fix this if you're using homebrew and bundler, add gem 'nokogiri' to the top of your Gemfile, then run these commands:

    gem uninstall nokogiri libxml-ruby
    brew update
    brew uninstall libxml2
    brew install libxml2 --with-xml2-config
    brew install libxslt
    bundle config build.nokogiri --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
    bundle install
    

    If you don't use bundler, run these commands instead:

    gem uninstall nokogiri libxml-ruby
    brew update
    brew uninstall libxml2
    brew install libxml2 --with-xml2-config
    brew install libxslt
    gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
    

    In your app, you should require nokogiri first, to force the app to load the dynamic libxml2 library instead of the older system version of libxml2 loaded by gems that failed to specify which library to load.

提交回复
热议问题