Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recipe terminated with fatal error: spawn latexmk ENOENT

I have just installed debian 10 as well as vscode. I have been struggling with this for 3 days now.. I installed texlive from terminal with the following command:

sudo apt install texlive

I then installed the latex workshop extension in vscode and tried building a .tex file. The following error popped up:

Recipe terminated with fatal error: spawn latexmk ENOENT.

I then preceded to install latexmk from terminal with:

sudo apt install latexmk

The same error kept popping up after that. The output showed this.

[14:59:34] Recipe step env: {}
[14:59:34] cwd: /home/phoenix/Documents/stellies/year4/2021/s&s-414/pracs/prac-4/report
[14:59:34] LaTeX build process spawned. PID: undefined.
[14:59:35] LaTeX fatal error: spawn latexmk ENOENT, . PID: undefined.
[14:59:35] Does the executable exist? PATH: /app/bin:/usr/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/node/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/cargo/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/python/bin
[14:59:35] The environment variable $SHELL: /bin/sh

I then proceded to review the texlive website. I noticed that i did not set the path variable to include the texlive binaries. The texlive website gives the following path to the binary files : PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH however /usr/local/texlive does not exist on my system for some reason. Where can i find the correct path to the texlive binaries on Debian 10?

like image 406
Sc0tty13 Avatar asked Jun 29 '21 13:06

Sc0tty13


3 Answers

I had the same problem. The root cause was: (1) software's bin folder missing from PATH; (2) bad file privileges. Consequently, VSC couldn't access latexmk, which explains the error messages.

In my case, the problem occurred on a mac, and specifically after I installed MacTex, which, in turn, installs Tex Live. I believe the same solution may apply to linux distros too.

Solution:

  1. Claim file ownership (which was originally root) under folder /usr/local/texlive: sudo chown -R <username> /usr/local/texlive, where <username> is the OS-level user name. The fix will work for this specific user. If it is not enough, try instead setting group owner appropriately, and/or consider Step 3.

  2. Add /usr/local/texlive/2021/bin/<software_dialect> to PATH. <software_dialect> depends on the installed software version: in my case it is universal-darwin; on linux it might be x86_64-linux.

  3. If the problem persists, try to change file access permissions under /usr/local/texlive using chmod.

EDIT: As a final step, restart VSC for changes to take effect.

like image 103
amka66 Avatar answered Oct 28 '22 08:10

amka66


I recently encountered the same problem on MacOS Monterrey (M1 based). I used basictex (just for the context). As required by the installation instruction,

  1. I added TeXLive to PATH,
  2. installed latexmk package to the TeX distribution.

However, still got the same error as OP.

Afte reading the wiki again more carefully, what finally worked for me was as simple as restarting VS Code and MacOS. Everything works as expected after a reboot of the MAC.

like image 5
chjch Avatar answered Oct 28 '22 09:10

chjch


I had this same problem on Mac recently, the fix that worked for me was to uninstall and reinstall the LaTeX Workshop extension.

like image 3
Gilbert M. Avatar answered Oct 28 '22 08:10

Gilbert M.