5

I'm having the same problem as described in the closed question "https://tex.stackexchange.com/questions/104350/problem-regarding-latexdiff-perl-and-miktex-2-9-on-win7".

Following the solution does not work in my case. However, the error message now includes the path I added (see below).

I've installed latexdiff via MikTeX 2.9 console on Win10. Originally tried with ActivePerl, then uninstalled and installed Strawberry Perl. Issue persists.

$ latexdiff
Can't locate Algorithm/Diff.pm in @INC (you may need to install the Algorithm::Diff module) (@INC contains: C \Strawberry\perl\site\lib /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 C:\Users\pea77\AppData\Local\Programs\MiKTeX 2.9\scripts/latexdiff\latexdiff line 193.
BEGIN failed--compilation aborted at C:\Users\pea77\AppData\Local\Programs\MiKTeX 2.9\scripts/latexdiff\latexdiff line 193.

2 Answers 2

6

Install the Algorithm::Diff package from Perl's CPAN package repository. You can do this by running the following command.

perl -MCPAN -e "install Algorithm::Diff"
2
  • I ran it and got C:\Strawberry\perl\bin>perl -MCPAN -e "install Algorithm::Diff" Database was generated on Mon, 11 Apr 2022 04:59:42 GMT Algorithm::Diff is up to date (1.201) However I still get the error Can't locate Algorithm/Diff.pm in @INC (you may need to install the Algorithm::Diff module) when using latexdiff
    – Hao S
    Apr 11 at 5:07
  • 1
    You shouldn't need to navigate to C:\Strawberry\perl\bin in order to run the command. If this is the case, it seems that your path is misconfigured, and the version of Perl used by latexdiff is different from the one you're using to install the package. For example, in my installation latexdiff probably pulls Perl from AppData/Roaming/TinyTeX/tlpkg/tlperl/bin/perl.exe. Apr 12 at 7:57
1

Installing from CPAN is the correct solution, but it fails with a cryptic error if you are using the Perl from MSYS2 under Windows. In that case install it with pacman:

pacman -S perl-Algorithm-Diff
1
  • Actually failed with the same error message in MSYS2, but your answer works. Thanks a lot.
    – hatmatrix
    Jun 28 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.