无法运行 Latexident macOS Monterey 12.0.1

问题描述 投票:0回答:2

我需要能够运行命令

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.

我通过此命令使用 Homebrew 安装了 MacTeX

brew install --cask mactex
。当我输入命令
which latexindent
时,它会给出这个
/usr/local/texlive/2021/bin/universal-darwin/latexindent
。我有 Perl v5.34.0,它在这里
/opt/homebrew/bin/perl

如何设置 PerlIO 的编码?

encoding homebrew macos-monterey tex-live perl5.34
2个回答
9
投票

我通过自制软件安装 Latexident 解决了这个问题。 命令是

brew install latexindent
。 我使用的是 MacOS Monterey 12.4

编辑:最近在 macOS Sonoma 14.4 上进行了测试,它仍然有效!


2
投票

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

  1. 我删除了:
    ~/perl5
    ~/.cpan
    ~/.cpanm
  2. 我重新启动了电脑;
  3. 然后我使用命令
    Log::Log4perl
    安装了
    cpan install Log::Log4perl
    。在那里它问我是否要选择自动或 手动配置模式。我选择了自动模式;
  4. 然后我基于this安装了其他模块 帖子
    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
并且它有效。

© www.soinside.com 2019 - 2024. All rights reserved.