perl - 由于缺少 perl 模块,在 Windows 10 上使用 LaTeX Workshop 在 VSCode 上格式化文档时出错
问题描述
我在 Visual Studio Code 和 MikTex 的最新版本和 ActivePerl 上安装了最新版本的 LaTeX Workshop:
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>
推荐阅读
- push-notification - 用于桌面应用程序的云消息传递系统
- mysql - Pomelo 和 EFCore 不会忽略迁移中的视图
- arrays - 使用 React Hooks 从数组中获取取消选择的项目
- reactjs - 自动反应js“运行脚本站点地图”
- web - 如何在 android 应用程序中添加 html 游戏或任何 URL 链接,它显示在相同的活动中而不打开 chrome 或任何东西?
- linux - 如何通过传入磁盘大小仅获取 UUID?
- javascript - 在 Electron 桌面应用程序中使用 Twain
- c# - dotnet-ef 与 net50 不兼容
- python - 使用python 3.7,如何确保正确修改正文内容后正确重新生成已解析的电子邮件而不会丢失任何内容?
- sails.js - addToCollection() 不适用于我创建的模型,但适用于预构建的“用户”模型