The reason is that the underlying chromote
R package tries to launch chrome via launch_chrome()
, which then again attempts to write into the file system at /tmp/Crashpad/new
.
If you navigate to the /tmp/Crashpad/new
directory you will likely see that another user owns this directory. This also means that this problem is probably specific to RStudio Server environments synchonously used by several users. It also explains why the problem does not occur right away. The first person running the code should not run into this Issue. However, everyone thereafter will.
One solution for the Problem is to deactivate the crash reporter before you take the screenshot. Of course this means no crash reports.
chromote::set_chrome_args("--disable-crash-reporter")
webshot2::webshot(url = "~/a_web_page.html", file = "~/an_image.png")
If you need the crash reports for some reason you can also ask the server admin to appropriately adjust the file system permissions.