This has become part of our server setup and does not have to be fixed per application.
Quick check: bin/rails runner 'puts Nokogiri::VersionInfo.new.libxml2_using_system?'
Nokogiri uses vendored libxml2 since version 1.6.0, which means that each time a new issue with libxml2 occurs, you have to update nokogiri itself. Another approach is to use the system lib again, as it patches the libxml2 library with periodically system updates.
bundle config --local build.nokogiri --use-system-libraries
.bundle
is not gitignored and .bundle/config contains
these lines:---
BUNDLE_BUILD__NOKOGIRI: "--use-system-libraries"
3. Either you remove the gem on the targets manually and reinstall it or you make a minor version upgrade of nokogiri to force the update
4. After all you can verfiy several things:
Nokogiri::VersionInfo.new.libxml2_using_system?
Nokogiri::VersionInfo.new.warnings
Nokogiri::VersionInfo.new.to_hash
bundle config
.spring stop
bundle install --force
to reinstall all your gems. It might take longer, but it is easier to automate as you don't have to pick out the right version and uninstall it with gem uninstall nokogiri
.