cpanm command not found

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

Introduction

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

cpanm: command not found

or when using sudo you get the following error message

sudo: cpanm: command not found

Solutions to cpanm: command not found

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

In Ubuntu cpanm is provided by cpanminus package.

cpanminus is:

cpanminus provides a command-line (non interactive) interface to automatically download, build and install Perl modules from CPAN.

It requires zero configuration, and stands alone. It also has a very low memory footprint compared to similar software: when running, it requires only 10MB of RAM.

It installs to wherever ExtUtils::MakeMaker and Module::Build are configured to. So if you’re using local::lib, then it installs to your local perl5 directory. Otherwise it installs to the siteperl directory.

cpanminus at a boot time checks whether you have configured local::lib, or have the permission to install modules to the sitelib directory. If neither, it automatically sets up local::lib compatible installation path in a perl5 directory under your home directory.

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

sudo apt-get -y install cpanminus

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

You can also use apt command to install cpanminus.

sudo apt -y install cpanminus

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

sudo aptitude install cpanminus

Summary

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