LaTeX-Workshop on VS Code keeps printing this error:

latexmk: The script engine could not be found.
latexmk: Data: scriptEngine="perl.exe", scriptName="latexmk"

I installed 'latexmk' via MikTeX 2.9, yet it still gives me this message. What do I have to do?


2 Answers 2


Quick summary:

  1. Install Perl from The Perl Programming Language. ActiveState Perl is recommended for beginners. Make sure to add the Perl local directory to your system Path.
  2. Install the latexmk package with your TeX distribution.
  • 1
    If you had used texlive instead of miktex, perl would have been included.
    – daleif
    Commented Dec 1, 2018 at 12:45
  • 2
    @daleif perfectly true, however many OLD install instructions still assume MiKTeX includes Perl as it formerly did. It may be worth mentioning that like TeX Live is "fuller" than incremental TeX such as W32 or Tiny or MiKTeX equally the fuller version of Perl should be the Strawberry flavour but MiKTeX plus ActiveState will be good enough for most latexmk on windows users.
    – user170109
    Commented Dec 1, 2018 at 13:10
  • 2
    K. Paul it may be worth mentioning that there are two things to check after installing Perl 1) check perl has included itself on the system path 2) check that the path is not terminated by a final semicolon; as this can supposedly upset latexmk searching beyond end of ; separated path for a non existent final entry.
    – user170109
    Commented Dec 1, 2018 at 13:16

That error occur because VS Code can't find perl (on your environment path).

You can test if it's exist or not using:

perl -v

If you already install MikTeX and VSCode, I suggest you install perl via Strawberry Perl.

Step by step Strawberry Perl installation for windows based on this source is:

  1. Make sure you do not have any version of Perl already installed. Check both add/remove programs and C:\Strawberry.
  2. Download msi file. As for this writing, choose between strawberry-perl- or strawberry-perl-, same as your system (64 or 32).
  3. Install.

To test your installation is success and Path already added, test using:

perl -v

Note: I already try install perl using ActiveState Perl, and the error persist. This is due to ActiveState installation will use ActiveState environment and does not add perl to Path. This might help a new user.

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 3, 2021 at 17:40
  • 1
    One more potential pitfall: I updated "latex-workshop.latex.tools" in my VS Code "settings.json" to set env.PATH to include the Perl path. I still got the above error. When I changed the name of the environment variable from "PATH" to "Path", things started working.
    – onnodb
    Commented Dec 13, 2021 at 20:56
  • Can you explain how exactly you did that?
    – Tera
    Commented Dec 28, 2021 at 20:33
  • @Tera what do you want to be cleared? Installing Strawberry Perl on windows will automatically setup environment Path on my case. Commented Dec 29, 2021 at 4:43
  • @MuhammadYasirroni I installed perl as explained by you and if I check via "perl -v" in the terminal everything is fine. Yet, VSC still does not find the perl.exe. So I wanted to try onnodb's approach, but I do not know what exactly to write into the "settings.json" file.
    – Tera
    Commented Dec 29, 2021 at 17:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .