I just tried my suggestion and it worked. I first tried uploading the RMarkdown document you sent me by itself and I got the same error you got. I then created a packages.R file that looked just like this:
library(learnr)
library(ggplot2)
And I included this file alongside the RMarkdown file when selecting which files to publish. The deployment messages showed the packages installing and the app worked fine, see here.
---
title: "Tutorial"
output: learnr::tutorial
runtime: shiny_prerendered
---
```{r setup, echo=FALSE, include=FALSE}
library(learnr)
library(ggplot2)
knitr::opts_chunk$set(echo = FALSE)
```
## Topic 1
```{r chunk1, exercise=TRUE}
ggplot()
```
## Topic 2
```{r chunk2,error=TRUE, include=TRUE,echo=TRUE,results='asis'}
This is a comment where I forgot the #
ggplot()
```