I created an empty R Markdown file, trying to convert it into a PDF file. I have installed the TinyTex package, but an error showed up:
output file: Test-File.knit.md
! ...sers\wjx\AppData\Roaming\TinyTeX\bin\win32\runscript.tlu:935: ...sers\wjx\AppData\Roaming\TinyTeX\bin\win32\runscript.tlu:858: no appropriate script or program found: fmtutil
! Running the command C:\Users\wjx\AppData\Roaming\TinyTeX\bin\win32\fmtutil-user.exe
! Running the command C:\Users\wjx\AppData\Roaming\TinyTeX\bin\win32\fmtutil-user.exe
! kpathsea: Running mktexfmt pdflatex.fmt
! The command name is C:\Users\wjx\AppData\Roaming\TinyTeX\bin\win32\mktexfmt
Error: LaTeX failed to compile Test-File.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Test-File.log for more info.
Execution halted
Before this error, I installed TinyTex package on R Studio, an error like below showed up :
> tinytex::install_tinytex()
trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
Content type 'application/octet-stream' length 104721853 bytes (99.9 MB)
downloaded 99.9 MB
Error in extract(pkg, exdir = path.expand(target)) :
cannot open file 'C:/Users/wjx/AppData/Roaming/TinyTeX/bin/win32/ucrtbase.dll': Permission denied
> tinytex::reinstall_tinytex()
If reinstallation fails, try install_tinytex() again. Then install the following packages:
tinytex::tlmgr_install(c("The system cannot find the path specified."))
The system cannot find the path specified.
The system cannot find the path specified.
Error in extract(pkg, exdir = path.expand(target)) :
cannot open file 'C:/Users/wjx/AppData/Roaming/TinyTeX/bin/win32/ucrtbase.dll': Permission denied
By the error message, I have tried install_tinytex() again, but it didn't work. I have also consulted the post: Installing package - cannot open file - permission denied. I tried the first solution: run R Studio as an administrator, and install TinyTex. Here is the message in the instalation process:
> install.packages("tinytex")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/wjx/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/tinytex_0.36.zip'
Content type 'application/zip' length 129074 bytes (126 KB)
downloaded 126 KB
package ‘tinytex’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\wjx\AppData\Local\Temp\RtmpIREM3V\downloaded_packages
So I installed Rtools by following the URL listed in the error message, but from then on, the error at the beginning of the post showed up every time I knit my R Markdown file to PDF.