nokogiri command not found

In this troubleshooting guide we learn how to fix nokogiri command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

nokogiri: command not found

or when using sudo you get the following error message

sudo: nokogiri: command not found

Solutions to nokogiri: command not found

How To Fix nokogiri: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu nokogiri is provided by ruby-nokogiri package.

ruby-nokogiri is:

Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. It is able to search documents via XPath or CSS3 selectors, and is a drop-in replacement for Hpricot (though not bug for bug).

To fix this problem, we can install more using the command below.

sudo apt-get -y install ruby-nokogiri

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install ruby-nokogiri.

sudo apt -y install ruby-nokogiri

Or if you have aptitude installed you can use the following command.

sudo aptitude install ruby-nokogiri

Summary

In this tutorial we learn how to fix nokogiri command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.