微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

由于缺少 perl 模块,在 Windows 10 上使用 LaTeX Workshop 在 VSCode 上格式化文档时出错

如何解决由于缺少 perl 模块,在 Windows 10 上使用 LaTeX Workshop 在 VSCode 上格式化文档时出错

我在 Visual Studio Code 上安装了最新版本的 LaTeX Workshop,以及 MikTex 的最新版本和 ActivePerl:

This is perl 5,version 28,subversion 1 (v5.28.1) built for MSWin32-x64-multi-thread
(with 1 registered patch,see perl -V for more detail)
copyright 1987-2018,Larry Wall
Binary build 0000 [25391a6d] provided by ActiveState http://www.ActiveState.com
Built Oct 28 2020 18:24:51

在 Windows 10 Pro 20H2 机器上。 我也有一个 IEEE 科学文档项目并且它构建正确,但是当我尝试格式化文档时出现此错误:`

[13:58:18] Start formatting with latexindent.
[13:58:18] Formatting with command latexindent -c,c:/Users/user/Desktop/path/,c:/Users/user/Desktop/path/__latexindent_temp.tex,-y=defaultIndent: '    ' 
[13:58:18] Formatting Failed with exit code 2
[13:58:18] stderr: Can't locate YAML/Tiny.pm in u/INC
   (you may need to install the YAML::Tiny module)
   (@INC contains: C:/Users/user/AppData/Local/Programs/MiKTeX/scripts/latexindent C:/Perl64/site/lib C:/Perl64/lib)
   at C:/Users/user/AppData/Local/Programs/MiKTeX/scripts/latexindent/LatexIndent/GetYamlSettings.pm line 20.

(为了可读性添加了换行符。)

搜索了有关如何安装缺少的 YAML::Tiny 模块的说明,但没有成功。 我见过一个叫做 ppm 的工具,但它似乎不再可用,我该如何安装这个和其他丢失的包?非常感谢。

解决方法

如果您使用的是 ActiveState 平台,您只需:

    state install yaml-tiny

如果您不使用它,您可以通过在 CMD 提示符下运行以下命令,从 ActiveState 平台在 Windows 上安装最新版本的 Perl 5.32:

    powershell -Command "& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://platform.activestate.com/dl/cli/install.ps1'))) -activate-default ActiveState/Perl-5.32"

然后你可以为你需要的每个包运行以下命令(状态工具就像 PPM 一样):

    state install <packagename>

    state import <CPANfile/Meta.json>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。