Solved!! Ruby on Rails Error. Ignoring nokogiri because its extension are not built. Try Gem pristine nokogiri --version 1.10.3

When developing in Rails, you might encounter this error:  Ignoring nokogiri because its extension are not built. Try Gem pristine nokogiri --version 1.10.3

Solution:

  1. Make sure that you include the version number of nokogiri in your Gem File and do: bundler install
    - If bundler install does not resolve the issue, make sure that you install the nokogiri first, using gem install nokogiri -v '1.10.3' --source 'https://rubygems.org/'
  2. If number 1 does not fix the problem, try gem pristine --all (this will restore all gem dependencies in pristine condition)
  3. Another possible solution is backing up your files and then delete Vendor Folder and the GemFile.lock file, after that do, bundle install, to install fresh dependencies. This error happens when there is a conflict between the version in your Working Tree and that in the Vendor Cache system. 
  4. Try running this command: bundle config build.nokogiri --use-system-libraries