Issue when creating pdf file while running knit, output file does not exist (knit-HTML is fine)

Output created: HW0.pdf
Error in tools::file_path_as_absolute(output_file) :
file 'HW0.pdf' does not exist
Calls: ->
In addition: Warning messages:
1: running command '"pdflatex" -halt-on-error -interaction=batchmode "HW0.tex"' had status 1
2: In readLines(logfile) : incomplete final line found on 'HW0.log'
Execution halted

I have no issue when running the knit-HTML, is just the pdf version.

Besides, I have checked the pdflatex is installed by running in command terminal.
it's the latest version of MikTeX.

1 Like

See suggestions in the thread here:


Thank you so much, I used one of his solution on mine.
And now its working!

Thank you very much. This worked for me.

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: