... it works on my machine ... ;-)
Although the Nokogiri Tutorial suggests handcrafting your local environment in complicated ways - see
https://www.nokogiri.org/tutorials/installing_nokogiri.html
- if adhering to any of these suggestions at all, I would escape ahead and try the direction of updating the system library rather than trying to make Nokogiri build against the older one, if only for the fact that if you install the gems using bundler you wouldn't want to mess around with manual gem installations, anyway. (Except for troubleshooting to retry this one gem over and over again until it works and then make sure bundler can do it, as well - but installing Nokogiri isn't the problem here).
... because: while you may not want to install on a web server at the end, adhering to the principle of declaring and isolating dependencies with the app as described in https://12factor.net/dependencies is still a great idea.
And bundler and rvm (or rbenv) are the tools for that in the ruby/rails world (or, for that matter, bundler and docker, which I wouldn't recommend in that situation).
If it still doesn't work with rvm, I would do the following:
(with the appropriate ruby version) creates a ruby-version+gemset combination and creates .ruby-* files in the dir making sure this gemset is used when you cd in this dir. all my rails-apps have this.
your path above shows that rvm throws all gems for one ruby version in one directory)
- delete all gems in the gemset:
$ rvm gemset empty
- and reinstall them:
- run:
$ gem install bundler
- and then:
$ bundle install
(this is a rude but efficient way to have rvm make sure that your app / rails / bundler won't pick up another version of any gem lingering around in your system-wide or rvm-ruby-version-wide gem folder - none of your logs showed which version of Nokogiri was actually running)
you can check on the gems in your gemset with `ls $(rvm gemset dir)/gems
nb: one of the Stack Overflow answers on this topic suggests putting gem rails
on the top of the Gemfile:
How to load correct version of dynamic libraries and gems (libxml, Nokogiri) within a custom Rails engine gem?
and indeed, Gemfile order matters starting up rails:
Does the order of gems in your Gemfile make a difference?
so this might be a good idea, as well.