You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Debian 10下VSCode LaTeX Workshop报错spawn latexmk ENOENT,如何查找TeX Live二进制文件正确路径?

Fixing "spawn latexmk ENOENT" in VSCode LaTeX Workshop on Debian 10

Hey there, let’s work through this frustrating issue you’ve been stuck on for 3 days. The core problem here is that your Flatpak-installed VS Code (we can tell from the .var/app/com.visualstudio.code-oss paths in your log) can’t find the latexmk executable you installed via apt. Let’s break this down step by step:

Step 1: Find the actual path of your TeX Live tools

Since you installed TeX Live and latexmk using apt (not the manual TeX Live download from the official site), their files aren’t in /usr/local/texlive—they’re in Debian’s default system directories. Run these commands to locate them:

  • To find exactly where latexmk is installed:

    which latexmk
    

    For more detailed output, you can also use:

    dpkg -L latexmk | grep bin
    

    Normally, apt-installed latexmk lives in /usr/bin/latexmk, but let’s confirm that.

  • Verify the path of other TeX tools (like pdflatex) to be sure:

    which pdflatex
    

    This should also point to /usr/bin if your apt installation worked correctly.

Step 2: Fix Flatpak VS Code’s sandbox access

Flatpak apps run in a sandbox that limits access to system files by default. Even if latexmk is in /usr/bin, VS Code’s sandbox might not be able to see it. Here are two ways to fix this:

Option 1: Grant VS Code access to the system bin directory

Open your terminal and run this command to let your Flatpak VS Code access /usr/bin (where your TeX tools live):

flatpak override com.visualstudio.code-oss --filesystem=/usr/bin

Restart VS Code after running this, then try compiling your .tex file again.

Option 2: Manually specify latexmk’s path in LaTeX Workshop settings

If the sandbox override doesn’t work, you can directly tell LaTeX Workshop where to find latexmk:

  1. Open VS Code and press Ctrl + , to open the Settings panel
  2. Search for LaTeX Workshop > Tools > Latexmk: Path
  3. Paste the full path you found in Step 1 (e.g., /usr/bin/latexmk) into this field
  4. Save the settings, then restart VS Code and test your compile

Step 3: Double-check environment variables (if needed)

If you still run into issues, you can manually add the TeX tools path to VS Code’s environment variables:

  1. In VS Code Settings, search for LaTeX Workshop > Environment
  2. Add a new entry with the key PATH and value /usr/bin:$PATH (replace /usr/bin with the path you found if it’s different)
  3. Save and restart VS Code to apply the changes

内容的提问来源于stack exchange,提问作者Renegade_Coder

火山引擎 最新活动