Fatal error: creating temporary file for '-e' failed

Hi, and welcome. A reproducible example, called a reprex would be helpful here.

Also, in RStudio, if you select File | New File | R Markdown | Document | pdf, can you knit the file? What version of R and R Studio? Are you on Mojave?