latexindent: Can't locate Log/ in @INC (you may need to install the Log::Log4perl module)

Thanks to @Nicola's comment, the error can be fixed as follows:

  1. The missing module is Log::Log4perl as found in the first line of the error.
  2. Open Win 10 start menu and search for CPAN client, then open it and run install Log::Log4perl. However, it may fail due to the common bug, which needs the installtion to be forced by running force install Log::Log4perl (from the CPAN client) or the other command prompt commands given by the answers to this question. In other words, for instance, the command cpan -f -i Log::Log4perl must be run from the command prompt NOT the CPAN client.
  3. Another module might be missing whose name can be identified as similarly done in the first step and installed the same way.

For others running into the same issue but on a Mac:

Install perl via brew:

brew install perl

Use cpan to install the necessary perl packages:

Open cpan and select yes if necessary to setup the config automatically:


Then install any packages mentioned in your error logs, you may need to install and retry several times to figure out all of the packages you need.

In my case these packages fixed the error messages:

install Log::Log4perl
install Log::Dispatch::File
install YAML::Tiny
install File::HomeDir

Catalina Update

If the installation fails with an error message that sounds like a permissions issue, that may be due to security changes in Catalina. In that case, try forcing the installation:

cpan -fi \
  Log::Log4perl \
  Log::Dispatch::File \
  YAML::Tiny \
  File::HomeDir \