You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Neovim/VimTeX编译报错:E482: Can't open file with an empty name 问题求助

Neovim/VimTeX编译报错:E482: Can't open file with an empty name 问题求助

最近我从零搭建了NVIM用来做个人Web开发,现在已经用得挺顺手了。不过因为马上要写毕业论文,想把它配置成支持LaTeX的环境,结果刚起步就碰到了第一个坎。

我用来测试的TeX文件非常简单,完全没有复杂内容:

\documentclass{article}

\title{"Test Document"}

\author{"Your Name"}

\date{\today}

\begin{document}

\maketitle

\section{Introduction}

This is a test document created for testing VimTeX functionality.

\section{Mathematics}

Here is an equation: $E=mc^2$.

\section{Lists}

\begin{itemize}

\item Item 1

\item Item 2

\item Item 3

\end{itemize}

\section{Conclusion}

Testing complete. This is the end of the document.

\end{document}

我觉得问题肯定不在测试文件上,还试过换不同文件名、不同目录来排除权限问题,但都没用。谷歌搜这个错误也找不到相关结果。我用lazy.nvim做插件管理器,VimTeX看起来加载得很正常。

在终端里用latexmk编译.tex文件完全没问题,但在NVIM里运行:VimtexCompile就直接报E482: Can't open file with an empty name。最离谱的是,用LazyVim的时候也会报同样的错,但它居然还能成功编译文件,这真的把我搞懵了。

我运行:VimtexInfo得到的信息如下:

System info:

OS: macOS 14.2 (23C64)

Vim version: NVIM v0.9.4

Has clientserver: true

Servername: undefined (vim started without --servername)

VimTeX project: main

base: main.tex

root: /Users/paul/Development/tmp/Playground/Latex/vimtex

tex: /Users/paul/Development/tmp/Playground/Latex/vimtex/main.tex

main parser: current file verified

document class: article

compiler: latexmk

engine: -pdf

options:

-verbose

-file-line-error

-synctex=1

-interaction=nonstopmode

callback: 1

continuous: 1

executable: latexmk

viewer: General

qf method: LaTeX logfile

看起来VimTeX已经正确识别了我的项目和文件。

我的vimtex.lua配置很简单:

return {

"lervag/vimtex",

lazy = false, -- lazy-loading will disable inverse search

}

如果还有什么信息需要补充的话,麻烦告诉我,我会尽快提供。有没有大佬知道这个问题该怎么解决?


编辑1:完整的错误信息如下:

Error detected while processing function vimtex#compiler#compile[6]..vimtex#compiler#start[17]..53:
line    6:
E482: Can't open file with an empty name

编辑2:我运行:echo tempname()的时候没有任何输出,会不会是这个原因导致的问题?

备注:内容来源于stack exchange,提问作者commitissues

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 12:09:30