gtsave() Function: "Cannot Find an Available Port" Error When Saving Table as PNG

I'm encountering an issue when using the gtsave() function from the gt package to save a table as a PNG file. The error message suggests that it cannot find an available port to start Chrome. Here are the details:

library(gt)
library(dplyr)

mtcars %>%
head() %>%
gt() %>%
gtsave("test.png")

Error in with_random_port():
! Cannot find an available port. Please try again.
Caused by error in startup():
! Failed to start chrome. Error:

  1. ├─mtcars %>% head() %>% gt() %>% gtsave("test.png")
  2. └─gt::gtsave(., "test.png")
  3. └─gt:::gt_save_webshot(data = data, filename, path, ...)
  4. └─webshot2::webshot(...)
    
  5.   └─chromote::default_chromote_object()
    
  6.     ├─chromote::set_default_chromote_object(Chromote$new())
    
  7.     └─Chromote$new()
    
  8.       └─chromote (local) initialize(...)
    
  9.         └─Chrome$new()
    
  10.          └─chromote (local) initialize(...)
    
  11.           └─chromote:::launch_chrome(path, args)
    
  12.            └─chromote:::with_random_port(launch_chrome_impl, path = path, args = args)
    

Has anyone else encountered this issue? Any suggestions or workarounds would be greatly appreciated!

Thanks in advance for your help!

I have the issue, it randomly just started yesterday. It is system wide for us.

I also just started having this issue with code that ran fine two weeks ago. I updated all my packages to no avail. The traceback is the same.

I found additional information from this thread. You can check it out by following this link.