Can't locate inc/Module/Install.pm in @INC (you may need to install the inc::Module::Install module) (@INC contains: ...)
In certain cases, when you try to install a Perl module from source code, (e.g. after cloning from GitHub), you run perl Makefile.PL and get an error message:
Can't locate inc/Module/Install.pm in @INC (you may need to install the inc::Module::Install module) (@INC contains: ...)with a long list of directories instead of the 3 dots.
This is a special case of the Can't locate ... in @INC error message.
Check out the other article explaining how you can install a Perl module from CPAN depending on your situation.
The developers of the module will have Module::Install on their system, and when they release the module to CPAN, part of the installer is automatically included in the zip file uploaded to CPAN. The part that is included in the inc/ subdirectory is called inc::Module::Install. It might be a bit strange if this is the first time you encounter it, but it works because ., the current working directory is part of @INC.
So when the Makefile.PL reached the use inc::Module::Install; statement, it will find the file in inc/Module/Install.pm. That is, in the packaged distribution of the module.
In regular circumstances, when you install the module from CPAN, it already comes with inc::Module::Install, and everything works fine. On the other hand, when you try to install the module from the version control system, that usually does not include the inc/ subdirectory. (And that's OK, these files should not be part of the version control system of the module under development.) In this case you basically act as the a developer of the said module, and you are expected to install Module::Install yourself to somewhere in @INC.
Once you have installed Module::Install, run perl Makefile.PL of the desired module again again. It will probably list the dependencies and even offer you to install them automatically.
Published on 2014-04-08