### Bug description

**Note:** I [reported this](https://community.rstudio.com/t/quarto-presentation-render-fails-on-second-try-after-deleting-cache-when-using-cache-with-leaflet-addprovidertiles/158757) over at community.rstudio.com, but I suppose that this is a better place for it.

I am using RStudio 2022.12.0 Build 353 with R version 4.2.2 Patched (2022-11-10 r83330) and knitr-1.41 on a Ubuntu  20.04.5 LTS installation.

I have identified a problem using `cache: true` in a quarto document that uses the `leaflet` package, specifically when using `addProviderTiles`. An example document that demonstrates the problem is below:

````
---
title: "test"
format: revealjs
---

## Create some random spatial data

```{r}
library(sf)
library(leaflet)

# List of volcanos -----------------------------------------
v = c("Volcán Villarica, Chile","Volcán Lonquimay, Chile")

lon = c("Volcán Villarica, Chile"=-71.93,
        "Volcán Lonquimay, Chile"=-71.58)
lon = lon[v]

lat = c("Volcán Villarica, Chile"=-39.42,
        "Volcán Lonquimay, Chile"=-38.38)
lat = lat[v]

volcanoes = data.frame(name=v,lon=lon,lat=lat)
volcanoes = st_as_sf(volcanoes,coords=c("lon","lat"),crs=4326)

lf = volcanoes |> leaflet() |> addTiles() |> addMarkers()
```

## This works with cache

```{r}
#| cache: true
lf
```

## This fails with cache on second render

```{r}
#| cache: true
lf |> addProviderTiles(providers$OpenTopoMap)
```
````

 The document renders without problem the first time before the `cache` exists, but the second time it fails with the following error about missing dependencies:

```
Error: path for html_dependency not found: /tmp/RtmpXpw2HT
Execution halted
```

Deleting the cache allows it to render again, but one looses the `cache` functionality.


### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
cderv
2023-01-30T16:04:06Z
dmkaplan2000
bug third-party
closed
Quarto presentation render fails on second try after deleting cache when using `cache` with `leaflet::addProviderTiles`
https://github.com/quarto-dev/quarto-cli/issues/4149