无法运行latexindent macOS Monterey 12.0.1



我需要能够运行命令latexindent,但每次都会出现以下错误:

Unknown PerlIO layer 'encoding' at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 21.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 126.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 134.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 135.
Attempt to reload PerlIO/encoding.pm aborted.
Compilation failed in require at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm line 20.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm line 20.
Compilation failed in require at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 29.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 29.
Compilation failed in require at /usr/local/texlive/2021/bin/universal-darwin/latexindent line 27.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/bin/universal-darwin/latexindent line 27.

我通过这个命令brew install --cask mactex安装了带有Homebrew的MacTeX。当我键入命令which latexindent时,它会给出这个/usr/local/texlive/2021/bin/universal-darwin/latexindent。我有Perl v5.34.0,它在这里/opt/homebrew/bin/perl

如何设置PerlIO的编码?

我通过自制程序安装latexindent解决了这个问题。命令为brew install latexindent。我在MacOS Monterey 12.4 上

基于这个问题,我找到了这样一个问题的解决方案:

  1. 我删除了:~/perl5~/.cpan~/.cpanm
  2. 我重新启动了电脑
  3. 然后我用命令cpan install Log::Log4perl安装了Log::Log4perl。在那里,它问我是想选择自动还是手动配置模式。我选择了自动模式
  4. 然后我在此基础上安装了其他模块帖子:SQL::StatementText::CSV_XSDBD::CSVLog::Dispatch::Filecpan install YAML::TinyFile::HomeDirUnicode::GCStringMac::SystemDirectory

最后命令latexindent --version给了我版本3.9.1, 2021-03-21,它就工作了。

最新更新