cannot knit an .rmd file to html


I tried everything! I tried resetting the CRAN mirror, uninstalling and then installing R, doing the same with all my packages in RStudio, hashtagging out the packages in RStudio...I have to knit a file to html and I am getting this message: (also, I tried testing another of my .rmd files in RStudio and even though in the past I could knit that one, I received this same error message)

Error in contrib.url(repos, "source") : Trying to use CRAN without setting a mirror

Call: ...withVisible -> eval -> eval -> install.packages -> contrib.url

Execution halted



Hi Heather, welcome!
We don't really have enough info to help you out. Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

1 Like


The error message

Error in contrib.url(repos, "source") : Trying to use CRAN without setting a mirror

suggests a mis-configuration of the CRAN repository. Two things to try:

  1. In RStudio's menu: Tools | Global Options | Packages | Management, makes sure that Global (CDN) - RStudio is the default.
  2. in the base R console, Package Installer choose CRAN binaries (Mojave) or CRAN source (Linux)

Without @adresrcs's suggestion, though, this is just a guess.

1 Like

closed #4

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.