hspec-discover command not found

In this troubleshooting guide we learn how to fix hspec-discover command not found error message

Introduction

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

hspec-discover: command not found

or when using sudo you get the following error message

sudo: hspec-discover: command not found

Solutions to hspec-discover: command not found

How To Fix hspec-discover: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu hspec-discover is provided by hspec-discover package.

hspec-discover is:

It is a useful convention to have one spec file for each source file. That way it is straightforward to find the corresponding spec for a given piece of code. But it requires error prone, and neither challenging nor interesting boiler plate code. So it should be automated. Hspec provides a solution for that. It makes creative use of GHC’s support for custom preprocessors. The developer only has to create a test driver that contains a single line.

A complete example is at https://github.com/hspec/hspec-example.

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

sudo apt-get -y install hspec-discover

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

You can also use apt command to install hspec-discover.

sudo apt -y install hspec-discover

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

sudo aptitude install hspec-discover

Summary

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