Error when trying to Compile PDF (knitr)

I am trying to compile the simplest possible example of a .Rnw file, but RStudio won't navigate to the correct pdflatex directory.

I'm using RStudio version 1.2.5042, R4.0, and MikTEX 2.9.7, on my Windows 10 machine.

I am able to compile the file using TEXworks without RStudio. Here's the document:

\documentclass{article}

\begin{document}
\SweaveOpts{concordance=TRUE}

Hello World.

\end{document}

Here's the error:

Running pdflatex.exe on untitled-3.tex...failed
Error running C:/Users/gabe/AppData/Local/Programs/MIKTEX~1.9/miktex/bin/x64/pdflatex.exe (exit code 1)

I have found online help and tried EVERYTHING suggested. For example, I tried all of the ideas presented here: https://stackoverflow.com/questions/51814278/set-path-to-miktex-for-pdflatex-in-r

I have also completely uninstalled and re-installed R, RStudio, and MikTEX.

Can anyone please help?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.