All, I'm having difficulty kniting my rmarkdown file. Error message is below. I'm using the latest R version, I've loaded MikTex and installed- tinytex::install_tinytex(), but no luck. Any help would be appreciated.
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: ... withVisible -> eval -> eval -> install.packages -> contrib.url
Execution halted
This is not an error with Rmarkdown, it is an error with R saying you don't have any CRAN repo configure. If you have a call to install.package or else in your Rmd doc, it could cause the error.
Just configure a cran mirror if you haven't one. Are you using RStudio IDE BTW?
Thanks for the response. I ran the getOption function and received an error message- "Error in getOptions("repos") : could not find function "getOptions". I am able to install packages from the console. I'm unable to knit a pdf or html.
I ran the function. It returned "TRUE". I am able to render the markdown file in the console. But still unable to knit to pdf or html. Same error message.
Your first error was about contrib.url so installed packages, and now you are talking about tinytex.
You said rendering at command line work, so tinytex should not be an issue.
try
rmarkdown::render("file.Rmd", "pdf_document'")
if you want to check.
The message above seems to have downloading the file correctly.
Anyway, update all the package, start in a fresh session and redo the step.
We need a reproducible example if you want us to help further. It is difficult to say much more. Anything can be the cause in your environment installation or else if we can't reproduce on our side.
But still getting the following error when knitting- Quitting from lines 12-29 (Assignment1_Casino_Station.Rmd)
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: ... withVisible -> eval -> eval -> install.packages -> contrib.url
Execution halted
This mean you have some code in the chunk lines 12-29 that causes this issue.
Are you trying to install package from inside the rmarkdown document ?
That is not good practice but it should not error like that.
What is the code in this chunk ?
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: