latexindent:未知的 PerlIO 层“编码”-格式化失败,退出代码为 255 macOS 12 Monterey

Posted

技术标签:

【中文标题】latexindent:未知的 PerlIO 层“编码”-格式化失败,退出代码为 255 macOS 12 Monterey【英文标题】:latexindent: Unknown PerlIO layer 'encoding' - Formatting failed with exit code 255 macOS 12 Monterey 【发布时间】:2022-01-16 00:48:18 【问题描述】:

我尝试使用 LaTeX WorkshopVisual Studio Code (1.63.0)macOS (12.0.1) 下运行 latexindent > 插件 (v8.22.0)。 它不起作用,因为在格式化过程中发生错误。

我已经安装了这些 cpan 包:

Lo​​g::Log4perl (1.54) Lo​​g::Dispatch::File (2.70) YAML::Tiny(1.73) 文件::HomeDir (1.006) Unicode::GCString (2013.10) 文件::HomeDir (1.006) Mac::SystemDirectory (0.13)

我还尝试使用此命令更新 CPATH 环境变量

export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/System/Library/Perl/5.34/darwin-thread-multi-2level/CORE:$CPATH

这也不起作用。

Perl 可执行文件位于此文件夹中:/opt/homebrew/bin/perl。我有版本 v5.34.0。 我已经读过这个latexindent: trouble installing File::HomeDir, Mac::SystemDirectory since macOS 11 Big Sur。

谁能给我一些关于如何解决这个问题的提示?

这是错误输出:

[23:14:18] Start formatting with latexindent.
[23:14:18] Formatting with command /Library/TeX/texbin/latexindent -c,/Users/daniel/Desktop/mwe/,/Users/daniel/Desktop/mwe/__latexindent_temp.tex,-y=defaultIndent: '    '
[23:14:18] Formatting failed with exit code 255
[23:14:18] stderr: Unknown PerlIO layer 'encoding' at /usr/local/texlive/2021basic/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 Encode.pm aborted.
Compilation failed in require at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm line 130.
BEGIN failed--compilation aborted at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm line 130.
Compilation failed in require at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/Verbatim.pm line 22.
BEGIN failed--compilation aborted at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/Verbatim.pm line 22.
Compilation failed in require at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/Lines.pm line 22.
BEGIN failed--compilation aborted at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/Lines.pm line 22.
Compilation failed in require at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 28.
BEGIN failed--compilation aborted at /usr/local/texlive/2021basic/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 28.
Compilation failed in require at /Library/TeX/texbin/latexindent line 27.
BEGIN failed--compilation aborted at /Library/TeX/texbin/latexindent line 27.

[23:14:18] File watcher - file changed: /Users/daniel/Desktop/mwe/mwe.tex
[23:14:18] Parsing a file and its subfiles: /Users/daniel/Desktop/mwe/mwe.tex
[23:14:18] Checking for duplicate labels: /Users/daniel/Desktop/mwe/mwe.tex.
[23:14:18] Auto build started detecting the change of a file: /Users/daniel/Desktop/mwe/mwe.tex
[23:14:18] BUILD command invoked.
[23:14:18] The document of the active editor: file:///Users/daniel/Desktop/mwe/mwe.tex
[23:14:18] The languageId of the document: latex
[23:14:18] Building root file: /Users/daniel/Desktop/mwe/mwe.tex
[23:14:18] onDidSaveTextDocument triggered: file:///Users/daniel/Desktop/mwe/mwe.tex
[23:14:18] Build root file /Users/daniel/Desktop/mwe/mwe.tex
[23:14:18] outDir: /Users/daniel/Desktop/mwe
[23:14:18] Recipe step 1: lualatex, -lualatex,-shell-escape,-synctex=1,-interaction=nonstopmode,-file-line-error,/Users/daniel/Desktop/mwe/mwe
[23:14:18] Recipe step env: undefined
[23:14:18] cwd: /Users/daniel/Desktop/mwe
[23:14:18] LaTeX build process spawned. PID: 4557.
[23:14:18] LaTeX log parsed with 0 messages.
[23:14:18] A step in recipe finished. PID: 4557.
[23:14:18] Recipe step 2: biber, mwe
[23:14:18] Recipe step env: undefined
[23:14:18] cwd: /Users/daniel/Desktop/mwe
[23:14:18] LaTeX build process spawned. PID: undefined.
[23:14:18] LaTeX fatal error: spawn biber ENOENT, . PID: undefined.
[23:14:18] Does the executable exist? $PATH: /Users/daniel/perl5/bin:/Library/TeX/texbin/:/Applications/flutter/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin
[23:14:18] Does the executable exist? $Path: undefined
[23:14:18] The environment variable $SHELL: /bin/zsh

【问题讨论】:

您似乎缺少 Perl 本身的一部分?! latexindent 脚本中的 shebang 行是什么?试试输入head -1 /Library/TeX/texbin/latexindent 这是 latexindent 脚本中的 shebang 行:#!/usr/bin/env perl@HåkonHægland @DanielSchreurs 好的,我要看看这个。你是如何安装latexindent的?那我先从tring开始重现你遇到的错误 我通过这个命令brew install --cask mactex 用 Homebrew 安装了 MacTeX。当我输入命令which latexindent 时,它会给出/usr/local/texlive/2021/bin/universal-darwin/latexindent。我有 Perl v5.34.0,它在这里/opt/homebrew/bin/perl。 @HåkonHægland 我尝试综合并主要隔离我的问题here 与一个新帖子。 【参考方案1】:

这个问题与macOS下latexindent的安装有关。我已经向here 提出了与此问题相关的更具体的问题,并给出了我的解决方案。

【讨论】:

以上是关于latexindent:未知的 PerlIO 层“编码”-格式化失败,退出代码为 255 macOS 12 Monterey的主要内容,如果未能解决你的问题,请参考以下文章

latexindent:自 macOS 11 Big Sur 以来安装 File::HomeDir、Mac::SystemDirectory 时遇到问题

为什么Perl的编码层没有任何影响?

Caffe 层创建失败 - 层类型未知

OpenCV 未知层类型运行暗网检测

使用 OpenCV readNetFromTensorFlow 运行 Keras DNN 模型(UNet):错误:操作解码器_stage0_upsampling/Shape 中的未知层类型形状

制作自定义 Keras 层时不能使用未知的输入尺寸(批量大小)