解决 VSCode format tex 文件时报错 Can’t locate YAML/Tiny.pm in @INC

这个错误的原因很简单,就是 YAML::Tiny 没安装,VSCode 安装 LaTeX Workshop 插件的时候不会自动安装,因此手动安装一下就可以解决。

cpan Unicode::GCString
cpan App::cpanminus
cpan YAML::Tiny
perl -MCPAN -e 'install "File::HomeDir"'

注意如果 perl 是 brew 安装的,每次 perl 升级后,会需要重新来一次。

By default non-brewed cpan modules are installed to the Cellar. If you wish
for your modules to persist across updates we recommend using `local::lib`.

为了避免麻烦,可以

PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"' >> ~/.bash_profile

One thought on “解决 VSCode format tex 文件时报错 Can’t locate YAML/Tiny.pm in @INC”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.