Phantom JS path for Shiny server


The code below works fine in my RStudio viewer but it doesn't work on my shiny server, and I think that is because the installation of phantomjs, which is required to use webshot package in R. How can I set the path to install that? I tried this webshot::install_phantomjs(), but it did not work. It was installed in shiny server, but i think it was installed in the wrong path.

output$savemapa <- downloadHandler(
filename = 'mymap.png',

content = function(file) {
  owd <- setwd(tempdir())
  saveWidget(mapa(), "temp.html", selfcontained = FALSE)
  webshot("temp.html", file = file, cliprect = "viewport", 
          zoom = 0.8, delay = 1)