Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML::Tiny module missing from MikTeX #374

Closed
ChadBailey opened this issue Jun 23, 2022 · 4 comments
Closed

YAML::Tiny module missing from MikTeX #374

ChadBailey opened this issue Jun 23, 2022 · 4 comments
Labels
Installation installation, documented at https://latexindentpl.readthedocs.io/en/latest/sec-appendices.html MikTeX

Comments

@ChadBailey
Copy link

ChadBailey commented Jun 23, 2022

Please provide the following when posting an issue:

original .tex code

\documentclass{article}
\begin{document}
hello world
\end{document}

yaml settings

Please paste your YAML settings (if any) here

actual/given output

Error log:

[10:00:00] Formatting failed with exit code 2
[10:00:00] stderr: Can't locate YAML/Tiny.pm in @INC (you may need to install the YAML::Tiny module) (@INC contains: /[redacted]/AppData/Local/Programs/MiKTeX/scripts/latexindent [redacted]/AppData/Local/Programs/MiKTeX/scripts/latexindent/ /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at [redacted]/AppData/Local/Programs/MiKTeX/scripts/latexindent/LatexIndent/GetYamlSettings.pm line 22.

desired or expected output

No error

anything else

Reason
I'm 100% new to Perl and LaTeX et all, so I'm surely doing something wrong. I also don't know if this is the fault of latexindent or MiKTeX, so my mistake if this is due to any of those things. I'm only posting to help the would-be newbie who doesn't have a software background.

Background/Setup
I installed MiKTeX to manage my LaTeX + utilities, expecting it to be able to supply every package I need for a command line implementation. I'm using Visual Studio Code for editing LaTeX, with the LaTeX Workshop extension. I installed latexindent via the MiKTeX GUI. This works mostly, but I get the error shown above. It appears to not have the Yaml extension as a dependency but I'm unsure.

The exe file being referenced, even after removal of latexindent, is at %LOCALAPPDATA%\Programs\MiKTeX\miktex\bin\x64\latexindent.exe

When attempting to run latexindent from the command line it would reference the above file, prompting to reinstall the package resulting in a repeat pattern.

Small potentially unrelated environment note: I am using Cygwin

Resolution
I manually removed %LOCALAPPDATA%\Programs\MiKTeX\miktex\bin\x64\latexindent.exe

Next I downloaded and extracted the .zip file from the latest release to a place folder in my %PATH%

This fully resolved the issue.

[10:22:31] Start formatting with latexindent.
[10:22:31] Format with command: latexindent
[10:22:31] Format with command args: ["-c","%DIR%/","%TMPFILE%","-y=defaultIndent: '%INDENT%'"]
[10:22:32] Formatted [redacted]\index.tex
@cmhughes
Copy link
Owner

Thanks for this.

Can you try the solution at https://tex.stackexchange.com/questions/577250/how-to-use-latexindent-on-windows

I've tried repeatedly to influence change on Miktex, but haven't been successful.

@cmhughes cmhughes added MikTeX Installation installation, documented at https://latexindentpl.readthedocs.io/en/latest/sec-appendices.html question user-centred question about behaviour of latexindent.pl answered question has been answered labels Jun 23, 2022
@cmhughes
Copy link
Owner

Oh, my mistake, I realise now that you've posted both a problem and a solution, thank you!

If ever you have ideas for improvements to the documentation, do feel free to submit a pull request :)

@cmhughes cmhughes removed question user-centred question about behaviour of latexindent.pl answered question has been answered labels Jun 23, 2022
@ChadBailey
Copy link
Author

ChadBailey commented Jun 23, 2022

No problem... sadly I am not fluent enough in MiKTeX, Perl, or LaTeX to really have any business attempting to resolve, but I would imagine the intended behavior is for this to work out of the box from MiKTeX.

If your package is broken in there, I would recommend either getting it fixed or delisting it. Having a broken package on the index doesn't do either side any favors. I wouldn't be quick to jump to that conclusion though, as I did not see anyone else post a similar issue anywhere.

For instance, perhaps this is a rare issue only invoked by a particular set of circumstances and this post along acts as ample documentation to the next poor person who runs into it. Hard to say.

I would recommend at minimum to figure out if the package needs YAML::Tiny to be declared as a dependency in the latexindent MiKTeX package, then get it declared if so,

If you do not maintain the latexindent MiKTeX package then I would recommend working with the person who is managing the package or request it be removed if you don't know who that is/how they are managing it.

An unknown package maintainer can be a huge security liability - they could one day slip a backdoor into the package without you knowing

At least, this is what I would say in other contexts. I have no idea how package management works with MiKTeX and Perl/LaTeX at large.

Hope that helps!

@ChadBailey
Copy link
Author

Github automatically displays this, but in case you missed it I have posted a bug report to MiKTeX at MiKTeX/miktex#1117

I hope this helps your voice be heard. I appreciate the hard work you've done on this tool, I think indentation and linting tools are under appreciated and critical to the workflow of people everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Installation installation, documented at https://latexindentpl.readthedocs.io/en/latest/sec-appendices.html MikTeX
Projects
None yet
Development

No branches or pull requests

2 participants