Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TeXStudio 无法启动 build #5

Closed
stone-zeng opened this issue Jan 6, 2019 · 8 comments
Closed

TeXStudio 无法启动 build #5

stone-zeng opened this issue Jan 6, 2019 · 8 comments
Labels
Editor & IDE Related to Editors & IDEs

Comments

@stone-zeng
Copy link
Member

最近经常遇到类似问题:TeXStudio 无法启动 Build & View,如下图所示

image

出现的原因五花八门,新手们又只知道截个图过来问,根本无法排查。有点什么头绪就列出来吧。

@stone-zeng stone-zeng added the Editor & IDE Related to Editors & IDEs label Jan 6, 2019
@muzimuzhi
Copy link
Collaborator

十一长假期间,曾远程桌面排查类似问题,最终也没有找到直接原因。后来对方反馈,安装发行版 proTeXt 后,问题消失。

(具体的聊天和浏览器记录已部分删除,以下叙述包含回忆部分。)

当时这个用户在终端也无法编译,甚至使用 tlmgr 也会报类似

Use of uninitialized value $ver in scalar chomp at .../TeXLive/TLWinGoo.pm line 204.

的错误。当时猜测系统环境变量有问题,因夜深而中断。该用户之前装过 CTeX 套装,新装了 TeX Live,就遇到了无法编译的问题。后来他通过再安装一个发行版绕过了问题,也就没有继续跟进。


搜到一个类似问题(12),是 R 用户在使用 TinyTeX 时遇到的。

解决方法很简单: windows 操作系统的环境变量里添加 PATH:c:\Windows\System32

@muzimuzhi
Copy link
Collaborator

也遇到过,用户为了「把编译方式从 pdflatex 改成 xelatex」而改错了 texstudio 的设置。例如
image

@stone-zeng
Copy link
Member Author

之前遇到的一位用的是 miktex,命令行可以编译,但在 texstudio 中却不行,检查了一下 build 设置也没有问题。后面基本放弃,希望他可以重装解决。

@Liam0205
Copy link
Contributor

Liam0205 commented Jan 8, 2019

可能的原因,大概分为两类。

  • TeXstudio 找不到 TeX 相关可执行文件的路径;
  • TeXstudio 找不到适合编译的 .tex 源文件。

前者可能的原因有:

  • 没有安装 TeX 发行版,只安装了 MiKTeX TeXstudio 等编辑器。
  • 安装 MiKTeX 后,环境变量 PATH 没有更新。这两种情况,让用户在 cmd 里执行 tex --version 观察其输出即可判断。
  • TeXstudio 内,相关路径设置错误。例如 TeXStudio 无法启动 build #5 (comment) 中截图所示的 txs

后者可能的原因有:

  • .tex 源文件名字中,含有 wchar

其他可能的疑难杂症包括:

  • ls-R 数据库挂了。这种情况以适当的权限执行 mktexlsr 即可。
  • format 文件挂了。这种情况重新 dump .fmt 文件即可:fmtutil-sys --all

@CTeX-org CTeX-org deleted a comment from zepinglee Jan 9, 2019
@CTeX-org CTeX-org deleted a comment from muzimuzhi Jan 9, 2019
@stone-zeng
Copy link
Member Author

再贴一个完整的错误 log:

Process started: pdflatex.exe -synctex=1 -interaction=nonstopmode "document".tex

Use of uninitialized value $ver in scalar chomp at D:/texlive/2018/tlpkg/TeXLive/TLWinGoo.pm line 206. Use of uninitialized value $ver in substitution (s///) at D:/texlive/2018/tlpkg/TeXLive/TLWinGoo.pm line 207. Use of uninitialized value $ver in substitution (s///) at D:/texlive/2018/tlpkg/TeXLive/TLWinGoo.pm line 207.

fmtutil: fmtutil is using the following fmtutil.cnf files (in precedence order): fmtutil: d:/texlive/2018/texmf-dist/web2c/fmtutil.cnf fmtutil: fmtutil is using the following fmtutil.cnf file for writing changes: fmtutil: c:/users/73994/.texlive2018/texmf-config/web2c/fmtutil.cnf fmtutil [INFO]: writing formats under c:/users/73994/.texlive2018/texmf-var/web2c fmtutil [INFO]: --- remaking pdflatex with pdftex

Can't spawn "cmd.exe": No such file or directory at d:\texlive\2018\texmf-dist\scripts\texlive\fmtutil.pl line 598. fmtutil [WARNING]: inifile pdflatex.ini for pdflatex/pdftex not found. fmtutil [INFO]: Disabled formats: 6 fmtutil [INFO]: Not selected formats: 43 fmtutil [INFO]: Failed to build: 1 (pdftex/pdflatex) fmtutil [INFO]: Total formats: 50 fmtutil [INFO]: exiting with status 1

D:\texlive\2018\bin\win32\runscript.tlu:790: command failed with exit code 1: perl.exe d:\texlive\2018\texmf-dist\scripts\texlive\fmtutil.pl --user --byfmt pdflatex

Running the command D:\texlive\2018\bin\win32\fmtutil-user.exe

kpathsea: Running mktexfmt pdflatex.fmt The command name is D:\texlive\2018\bin\win32\mktexfmt

Process exited with error(s)

前面指出的解决方法「添加 C:\Windows\System32 到 PATH 环境变量」确实有效。

@zhanlaoban
Copy link

十一长假期间,曾远程桌面排查类似问题,最终也没有找到直接原因。后来对方反馈,安装发行版 proTeXt 后,问题消失。

(具体的聊天和浏览器记录已部分删除,以下叙述包含回忆部分。)

当时这个用户在终端也无法编译,甚至使用 tlmgr 也会报类似

Use of uninitialized value $ver in scalar chomp at .../TeXLive/TLWinGoo.pm line 204.

的错误。当时猜测系统环境变量有问题,因夜深而中断。该用户之前装过 CTeX 套装,新装了 TeX Live,就遇到了无法编译的问题。后来他通过再安装一个发行版绕过了问题,也就没有继续跟进。

搜到一个类似问题(12),是 R 用户在使用 TinyTeX 时遇到的。

解决方法很简单: windows 操作系统的环境变量里添加 PATH:c:\Windows\System32

解决就我的问题,感谢老哥!

@SainoNamkho
Copy link

SainoNamkho commented Aug 19, 2022

@SainoNamkho
Copy link

SainoNamkho commented Aug 19, 2022

texstudio有两种报错,一种在消息窗口 https://github.com/texstudio-org/texstudio/blob/e85190d8d0837bedad6636586b986dc088d93e29/src/buildmanager.cpp#L2506-L2517

另一种是弹窗 https://github.com/texstudio-org/texstudio/blob/d6f13e06fa06ddbc506fa7b2bb96e692f1e0b038/src/texstudio.cpp#L6079-L6084

弹窗说明可执行文件能找到、运行失败、没有文件名对应的log

排查的话要求提问者texstudio全窗口截图(包括消息窗口的错误)、命令行编译并查看是否有log产生。
如果命令行与texstudio窗口编译结果不同,可能是texstudio进程启动后更改了环境变量,重启texstudio可解决。
另外可临时将texstudio编译命令设为cmd /c "where pdflatex"与命令行运行where pdflatex结果对比。

不产生log的情况,总结了一下大概有:

  1. 文件路径含有特殊字符,导致编译出的log文件路径跟texstudio拼装出的log文件路径不同,根据 https://github.com/texstudio-org/texstudio/blob/8c898844d87d4ba640f5c7684c0180cc463c49af/src/latexdocument.cpp#L2016-L2026 magic comment 也有影响
  2. fmt不匹配,导致没有产生log就直接报错退出,这种情况命令行编译可排查出问题
  3. texstudio自身问题,同时打开已保存的文件跟临时文件以及root comment之类,可能导致识别错当前文件名
  4. 编译成 cls 或 sty 文件,全窗口截图可从标签页发现错误。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Editor & IDE Related to Editors & IDEs
Projects
None yet
Development

No branches or pull requests

5 participants