无法运行 latexindent macOS Monterey 12.0.1
Posted
技术标签:
【中文标题】无法运行 latexindent macOS Monterey 12.0.1【英文标题】:Unable to run latexindent macOS Monterey 12.0.1 【发布时间】:2022-01-17 08:13:20 【问题描述】:我需要能够运行命令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 的编码?
【问题讨论】:
【参考方案1】:基于this question,我找到了解决我的问题的方法:
-
我删除了:
~/perl5
、~/.cpan
、~/.cpanm
;
我重新启动了计算机;
然后我使用命令cpan install Log::Log4perl
安装了Log::Log4perl
。那里问我是否要选择自动或
手动配置模式。我选择了自动模式;
然后我根据this
post安装了其他模块:
SQL::Statement
,Text::CSV_XS
,DBD::CSV
,Log::Dispatch::File
,cpan install YAML::Tiny
,File::HomeDir
,Unicode::GCString
,Mac::SystemDirectory
;
最后,latexindent --version
命令给了我3.9.1, 2021-03-21
的版本,它可以工作。
【讨论】:
不再需要 Log4perl :)以上是关于无法运行 latexindent macOS Monterey 12.0.1的主要内容,如果未能解决你的问题,请参考以下文章
latexindent:自 macOS 11 Big Sur 以来安装 File::HomeDir、Mac::SystemDirectory 时遇到问题