Hi,
Thanks for asking this question. Ruby 2.4 is quite old, so you may be in for a bit of tough time. I'll also note that this is not a Nokogiri-specific question -- you're really asking, "how do I resolve dependencies for an old project using an old version of Ruby." But I'll try to help!
To describe what's going on: the "gem" tool is trying to resolve dependencies for rails v5.0.1 and it's doing it wrong. It's likely a version of rubygems that doesn't correctly take into account gems' `required_ruby_version` when resolving dependencies. It's curious that it's decided to look for "nokogiri (~> 1.14)" which doesn't match the default that Rails 5.0.1 needs, and isn't a valid version for Ruby 2.4; you may wish to try to discover where that version specification is coming from. The last version of Nokogiri to support Ruby 2.4 is 1.10.10 (it was removed from support in
Nokogiri 1.11.0).
The best advice I can give you, particularly because you're using an old version of Ruby, is to use `bundler` and a Gemfile to declare and resolve your dependencies. Modern bundler generally knows how to resolve dependencies correctly for a wide variety of situations.
If you have a "Gemfile" and a "Gemfile.lock" for your project, then "bundle install" might just work and you're done.
If you don't have a "Gemfile.lock", but you do have a "Gemfile", then you'll need to resolve dependencies. Make sure to install and use the most recent version of bundler that supports Ruby 2.4. "gem install bundler" should work, but if it doesn't, find the most recent version that supports Ruby 2.4 and run "gem install bundler -v <VERSION>". Then try running "bundle install".
If you don't have a "Gemfile", then you'll need to piece together your application's dependencies. Start with a "Gemfile" that just contains your source line and a line declaring a rails dependency, run "bundle install", and then try to boot the app. See what fails, add it as a dependency, bundle-install, and try booting again. Repeat until you've assembled the dependencies.
Finally: if you can't use bundler for whatever reason, then upgrade to the latest version of rubygems (which provides the "gem" tool) that supports Ruby 2.4, and try "gem install rails" again.
If you're struggling with any of these steps (I'm not sure how familiar you are with bundler and rubygems), or they just don't work for you, you may wish to try asking this question in a more general Ruby forum.
Good luck!
-mike