[Tex/LaTex] R Sweave does not compile to PDF

miktexsweave

I have installed MikTex and Rstudio to use R sweave. I wrote the most basic code on R sweave. I have used it on another Windows laptop but while using it on another windows laptop in the exact same manner, it does not compile the PDF. They are both Windows 10, 64-bit systems. This is my code:

\documentclass{article}

\begin{document}
\SweaveOpts{concordance=TRUE}
Hello WOrld!


\end{document} 

This the end error that it returns if I set Weaver to Sweave in Global options:

Writing to file s2.tex
Processing code chunks with options …

You can now run (pdf)latex on 's2.tex'
Running pdflatex.exe on s2.tex…failed
Error running C:/Users/HPAIO~1/AppData/Local/Programs/MiKTeX/miktex/bin/x64/pdflatex.exe (exit code -1073740791)

If Weaver is set to knitr, then error is this:
Loading required package: knitr

processing file: s2.Rnw
|…………………………………………………………….| 100%
ordinary text without R code

output file: s2.tex

[1] "s2.tex"
Warning message:
In remind_sweave(if (in.file) input, sweave_lines) :
It seems you are using the Sweave-specific syntax in line(s) 4; you may need Sweave2knitr("s2.Rnw") to convert it to knitr
Running pdflatex.exe on s2.tex…failed
Error running C:/Users/HPAIO~1/AppData/Local/Programs/MiKTeX/miktex/bin/x64/pdflatex.exe (exit code -1073740791)

When I click of "View Log", it shows a pop up of "The system cannot find the file specified"

The only difference I see between the computer that ran sweave without issues is that \SweaveOpts {Concordance=TRUE} was not a default line there. But I do not know what that implies, if anything.

Thanks in anticipation.

Best Answer

The solution that has worked for me has been to completely uninstall MikTex and install an older version (MiKTeX64-2.9.7269-basic) and not update Miktex or the packages. At first run, it gave me an error because could not find some packages and I installed them manually (for example 'grfext', which I downloaded from CTAN org, run the .dtx from my latex editor and it installed).

---> Win 10 64bits RStudio 1.4953