Problem: You can’t install the nokogiri gem while using Ubuntu or Linux Subsystem for Windows. You are mostlikely missing zlib which will be indicated by the following error:
zlib is missing; necessary for building libxml2
Solution: You can install zlib and nokogiri in one go by using the following code to first install ylib and then install nokogiri.
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
gem install nokogiri