TeX - LaTeX Asked on September 28, 2021
I have Strawberry Perl and MiKTeX v2.9 installed on Windows 10 with the latexindent
package installed via the MiKTeX console.
However, running latexindent.pl
in the command prompt results in the following error
Can’t locate Log/Log4perl.pm in @INC (you may need to install the
Log::Log4perl module) (@INC contains: C:/Program Files/MiKTeX
2.9/scripts/latexindent C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib) at C:/Program
Files/MiKTeX 2.9/scripts/latexindent/LatexIndent/LogFile.pm line 22.
BEGIN failed–compilation aborted at C:/Program Files/MiKTeX
2.9/scripts/latexindent/LatexIndent/LogFile.pm line 22. Compilation failed in require at C:/Program Files/MiKTeX
2.9/scripts/latexindent/LatexIndent/Document.pm line 25. BEGIN failed–compilation aborted at C:/Program Files/MiKTeX
2.9/scripts/latexindent/LatexIndent/Document.pm line 25. Compilation failed in require at C:Program FilesMiKTeX
2.9scriptslatexindentlatexindent.pl line 27. BEGIN failed–compilation aborted at C:Program FilesMiKTeX
2.9scriptslatexindentlatexindent.pl line 27.
Additionally, this answer doesn’t help in removing the error.
So, what is missing here?
Thanks to @Nicola's comment, the error can be fixed as follows:
Log::Log4perl
as found in the first line of the error.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.Correct answer by Diaa on September 28, 2021
Log4perl is definitely no longer required. See comments.
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:
cpan
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
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
Unicode::GCString
Answered by songololo on September 28, 2021
New problems arise for Big Sur. Here is my Fix.
(The solution assumed you've installed homebrew. )
brew install perl
brew install cpanm
MacOSX10.14.sdk
Install the missing packages directly will raise the build error:
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk' [-Wmissing-sysroot]
That's because:
Apple decided to stop naming their SDKs with versions but rather name them MacOSX.sdk and include an alias with the version name for compatibility
So we create symlink for this folder. (Difference between recent SDKs is minor)
> cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
> sudo ln -s MacOSX.sdk MacOSX10.14.sdk
cpanm YAML::Tiny
cpanm File::HomeDir
cpanm Unicode::GCString
cpanm Log::Log4perl
cpanm Log::Dispatch
Answered by Boyan on September 28, 2021
As of Version 3.9 the Log4Perl
module is no longer loaded by latexindent.pl
.
Details of the required perl modules are documented and sample installations steps are given in .travis.yml and appveyor.yml
I sincerely hope that this eases installation and use of the tool. If you can help make latexindent.pl
better, or have any questions, please visit https://github.com/cmhughes/latexindent.pl.
Answered by cmhughes on September 28, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP