Analogy: trying to pin the tail on the donkey, or hit a pinata blindfolded
Make sure RStudio and the rmarkdown package (and its dependencies) are up-to-date.
Set a global option for error = TRUE (or for a given chunk) so that your document renders even when there are errors.
Don’t try to change working directory within an R Markdown document. (If you do still decide to use setwd in a code chunk, beware that the new working directory will only apply to that specific code chunk, and any following code chunks will revert back to use the original working directory.)
- switch latex engines (do a screenshot here)
- consider printing out your
sessionInfo()[for pro-level, use DT]