mapshot error: webshot.js returned failure value: 1
I have a similar Problem. I am working with R Markdown and so far I created a html report with maps. The maps were created with leaflet and then converted into a jpg with mapshot. Since the last R update mapshot(leafletmap, file.jpg) creates this error: Error in (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744, : webshot.js returned failure value: 1
Any help is much appreciated!
I want to make my question more concrete with an reproducible example:
library("leaflet") library("rgeos") library("maptools") library("mapview")
m <- leaflet() %>% addTiles() %>% # Add default OpenStreetMap map tiles addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R") m mapshot(m, file = "C:/Users/kkueth/Rplot2.jpg", fgb = FALSE) # Hier einen passenden Speicherort suchen
(by the way: I have found a similar problem on github that is already closed without solution, but I didnt manage to reopen it)
I can only guess (as I have no problem with the example) that your webshot.js installation is somehow not correct. Have you tried re-installing webshot or at least using webshot::webshot() directly?
Thank you for your answer and the information that it works for you. Re-installing webshot or using webshot::webshot() doesn't work for me. I guess the R update saved the whole win-library on a new destination (I don't know why). I try to fix this by deleting and installing R again.
@tim-salabim I deleted R and RStudio and installed both from the beginning, but nothing changed. I have no idea what else I could try out. Do you have any suggestions?
What seems weird to me: I use R on two different servers and both show the same error. (with one of them I tried the reinstallation of R)
Does it work on a non-server machine?
Yes, actually one is a laptop and one is a server.
Yes, as in yes it works?
no, in both laptop and server it doesn`t work
hm, then it might have to do with the phantom.js setup. I think, especially as you say that it also fails with webshot, this is best filed as an issue at https://github.com/wch/webshot/issues
To make it more concrete:
I work on a laptop and remote on a server (to be able to handle more data). On both (laptop and the server) R and R Studio is installed and on both it doesnt work. On the laptop I tried the reinstallation of R but this didnt help.
hm, then it might have to do with the phantom.js setup. I think, especially as you say that it also fails with webshot, this is best filed as an issue at https://github.com/wch/webshot/issues
Thank you, I will try this
I am facing the same issue as KathaRRRina.
In my case, however, webshot works properly (I have already seen the proposed solutions here https://github.com/wch/webshot/issues/112
The following reproducible example creates the .jpg through webshot but not through mapshot.
library(leaflet) library(mapview) library(webshot) library(htmlwidgets)
m <- leaflet() %>% addTiles() %>% # Add default OpenStreetMap map tiles addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R") m
saveWidget(m, file = paste0(getwd(), "/m.html")) mapshot(m, file = paste0(getwd(),"/m.jpg"), debug=T) webshot::webshot(url = paste0(getwd(), "/m.html"), file = paste0(getwd(),"/m.jpg"), debug=T) sessionInfo()
m <- leaflet() %>% addTiles() %>% addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R") m
saveWidget(m, file = paste0(getwd(), "/m.html")) mapshot(m, file = paste0(getwd(),"/m.jpg"), debug=T) [info] [phantom] Starting... [info] [phantom] Running suite: 1 step [debug] [phantom] Successfully injected Casper client-side utilities [info] [phantom] Step anonymous 1/1: done in 81ms. [info] [phantom] Step anonymous 2/2: done in 83ms. [info] [phantom] Step _step 3/7: done in 102ms. [debug] [phantom] opening url: C:\Users\ADMINI~1\AppData\Local\Temp\Rtmp2bC9yR\file161c651d470d.html, HTTP GET [debug] [phantom] Navigation requested: url=c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmp2bC9yR%5Cfile161c651d470d.html, type=Other, willNavigate=true, isMainFrame=true [warning] [phantom] Loading resource failed with status=fail: c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmp2bC9yR%5Cfile161c651d470d.html Could not load c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmp2bC9yR%5Cfile161c651d470d.html [debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true [debug] [phantom] url changed to "about:blank" Error in (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744, : webshot.js returned failure value: 1 webshot::webshot(url = paste0(getwd(), "/m.html"), file = paste0(getwd(),"/m.jpg"), debug=T) [info] [phantom] Starting... [info] [phantom] Running suite: 1 step [debug] [phantom] Successfully injected Casper client-side utilities [info] [phantom] Step anonymous 1/1: done in 40ms. [info] [phantom] Step anonymous 2/2: done in 51ms. [info] [phantom] Step _step 3/7: done in 71ms. [debug] [phantom] opening url: file:///C:/Users/Administrator/Documents/m.html, HTTP GET [debug] [phantom] Navigation requested: url=file:///C:/Users/Administrator/Documents/m.html, type=Other, willNavigate=true, isMainFrame=true [debug] [phantom] url changed to "file:///C:/Users/Administrator/Documents/m.html" [debug] [phantom] Successfully injected Casper client-side utilities [info] [phantom] Step _step 5/7: done in 1108ms. [info] [phantom] wait() finished waiting for 200ms. [info] [phantom] Step anonymous 6/7: done in 1328ms. [debug] [phantom] Capturing page to C:/Users/Administrator/Documents/m.jpg [info] [phantom] Capture saved to C:/Users/Administrator/Documents/m.jpg [info] [phantom] Step anonymous 7/7: done in 1477ms. [info] [phantom] Done 7 steps in 1477ms [debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true [debug] [phantom] url changed to "about:blank"
sessionInfo() R version 4.1.2 (2021-11-01) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=Norwegian Bokmål_Norway.1252 LC_CTYPE=Norwegian Bokmål_Norway.1252
[3] LC_MONETARY=Norwegian Bokmål_Norway.1252 LC_NUMERIC=C
[5] LC_TIME=Norwegian Bokmål_Norway.1252
system code page: 65001
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] htmlwidgets_1.5.4 webshot_0.5.3 mapview_2.11.0 leaflet_2.1.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 compiler_4.1.2 pillar_1.7.0 base64enc_0.1-3 class_7.3-19
[6] tools_4.1.2 digest_0.6.29 jsonlite_1.8.0 tibble_3.1.6 satellite_1.0.4
[11] lifecycle_1.0.1 lattice_0.20-45 pkgconfig_2.0.3 png_0.1-7 rlang_1.0.2
[16] cli_3.3.0 DBI_1.1.2 crosstalk_1.2.0 yaml_2.3.5 fastmap_1.1.0
[21] terra_1.5-21 e1071_1.7-9 dplyr_1.0.8 raster_3.5-15 generics_0.1.2
[26] vctrs_0.4.1 tidyselect_1.1.2 stats4_4.1.2 classInt_0.4-3 grid_4.1.2
[31] glue_1.6.2 sf_1.0-7 R6_2.5.1 processx_3.5.3 fansi_1.0.3
[36] sp_1.4-7 callr_3.7.0 purrr_0.3.4 magrittr_2.0.3 ps_1.7.0
[41] ellipsis_0.3.2 scales_1.2.0 codetools_0.2-18 htmltools_0.5.2 units_0.8-0
[46] assertthat_0.2.1 colorspace_2.0-3 utf8_1.2.2 KernSmooth_2.23-20 proxy_0.4-26
[51] munsell_0.5.0 leafem_0.2.0 crayon_1.5.1
I am happy that I am not alone :)
For me it now it works exactly like for @niknikos :
webshot creates the jpg, but mapshot doesn't.
Thank you for your examples @niknikos, they helped me to find out how to create the jpg with webshot.
However, the mapshot version needs less code, so I would still be happy about a solution of the problem.
Same problem for me, webshot creates the jpg, but mapshot doesn't.
sessionInfo() R version 4.1.3 (2022-03-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042)
Hi all, please see https://github.com/r-spatial/mapview/issues/423#issuecomment-1146598142 Can you please install that branch and let me know if it solves the spurrious webshot error you've been experiencing?
Hi @tim-salabim ,
Thanks for the effort. I installed the suggested branch at #423 and used the example there.
library(mapview) library(stars)
#Sys.setenv("CHROMOTE_CHROME" = "/usr/bin/brave-browser") # just in case chromote cannot find a suitable browser
lc <- read_stars(system.file('tif/lc.tif',package='stars')) tst_mv = mapview(lc) tst_mv # legend there mapshot(x = tst_mv, file = paste0(getwd(),"/test.png")) # legend gone
When running R-Studio in user mode, mapshot creates the .png or .pdf image as expected. When running R-Studio in admin mode, mapshot does not create the .png or .pdf image as expected, throwing the following error message:
Error in s$close() : attempt to apply non-function
traceback() reports the following:
15: stop(value) 14: doTryCatch(return(expr), name, parentenv, handler) 13: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 12: tryCatchList(expr, classes, parentenv, handlers) 11: tryCatch({ result <- force(expr) if (is.promising(result)) { value <- NULL type <- NULL result$then(function(val) { value <<- val type <<- "success" })$catch(function(reason) { value <<- reason type <<- "error" }) while (is.null(type) && !domain$interrupted) { run_now(loop = loop) } if (is.null(type)) { generateInterrupt() } else if (type == "success") { value ... 10: force(expr) 9: domain$wrapSync(expr) 8: with_promise_domain(domain, { tryCatch({ result <- force(expr) if (is.promising(result)) { value <- NULL type <- NULL result$then(function(val) { value <<- val type <<- "success" })$catch(function(reason) { value <<- reason type <<- "error" }) while (is.null(type) && !domain$interrupted) { run_now(loop = loop) } if (is.null(type)) { generateInterrupt() } else if (type == "success") { ... 7: synchronize(p, loop = private$child_loop) 6: cm$wait_for(p) 5: (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744, selector = NULL, cliprect = NULL, expand = NULL, delay = 0.2, zoom = 1, useragent = NULL, max_concurrent = getOption("webshot.concurrent", default = 6)) { if (length(url) == 0) { stop("Need url.") } url <- vapply(url, function(x) { if (!is_url(x)) { file_url(x) } else { x } }, character(1)) if (!is.null(cliprect) && !is.list(cliprect)) cliprect <- list(cliprect) if (!is.null(selector) && !is.list(selector)) selector <- list(selector) ... 4: do.call(webshot2::webshot, args[ws_args]) 3: withCallingHandlers(expr, message = function(c) if (inherits(c, classes)) tryInvokeRestart("muffleMessage")) 2: suppressMessages(do.call(webshot2::webshot, args[ws_args])) 1: mapshot(x = tst_mv, file = paste0(getwd(), "/test.png"))
In my case, I need to be using R-Studio in admin mode to build my book using bookdown, so the suggested solution is not sufficient. In the past, i.e. before replying to the post here, this was not a problem. Mapshot worked properly in admin mode, too. Hope the above and the session info is helpful.
sessionInfo() R version 4.1.2 (2021-11-01) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=Norwegian Bokmål_Norway.1252 LC_CTYPE=Norwegian Bokmål_Norway.1252
[3] LC_MONETARY=Norwegian Bokmål_Norway.1252 LC_NUMERIC=C
[5] LC_TIME=Norwegian Bokmål_Norway.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stars_0.5-5 sf_1.0-7 abind_1.4-5 htmlwidgets_1.5.4 webshot_0.5.3
[6] mapview_2.11.0.9001 leaflet_2.1.1
loaded via a namespace (and not attached):
[1] webshot2_0.1.0 tidyselect_1.1.2 terra_1.5-21 purrr_0.3.4
[5] lattice_0.20-45 leaflet.providers_1.9.0 colorspace_2.0-3 vctrs_0.4.1
[9] generics_0.1.2 htmltools_0.5.2 stats4_4.1.2 yaml_2.3.5
[13] base64enc_0.1-3 utf8_1.2.2 rlang_1.0.2 e1071_1.7-9
[17] pillar_1.7.0 later_1.3.0 glue_1.6.2 DBI_1.1.2
[21] sp_1.4-7 lifecycle_1.0.1 munsell_0.5.0 chromote_0.1.0
[25] raster_3.5-15 websocket_1.4.1 codetools_0.2-18 fastmap_1.1.0
[29] ps_1.7.0 crosstalk_1.2.0 parallel_4.1.2 curl_4.3.2
[33] class_7.3-20 fansi_1.0.3 leafem_0.2.0 Rcpp_1.0.8.3
[37] KernSmooth_2.23-20 scales_1.2.0 promises_1.2.0.1 classInt_0.4-3
[41] satellite_1.0.4 lwgeom_0.2-8 jsonlite_1.8.0 farver_2.1.0
[45] png_0.1-7 digest_0.6.29 processx_3.5.3 dplyr_1.0.9
[49] grid_4.1.2 cli_3.3.0 tools_4.1.2 magrittr_2.0.3
[53] proxy_0.4-26 tibble_3.1.7 crayon_1.5.1 pkgconfig_2.0.3
[57] ellipsis_0.3.2 rstudioapi_0.13 assertthat_0.2.1 R6_2.5.1
[61] units_0.8-0 compiler_4.1.2
Hi, from my side, I still have errors with mapshot.
> mapshot(x = tst_mv, file = paste0(getwd(),"/test.png")) # legend gone
Error in open.connection(con, "rb") : HTTP error 503.`
> traceback()
15: open.connection(con, "rb")
14: open(con, "rb")
13: parse_con(txt, bigint_as_char)
12: parseJSON(txt, bigint_as_char)
11: parse_and_simplify(txt = txt, simplifyVector = simplifyVector,
simplifyDataFrame = simplifyDataFrame, simplifyMatrix = simplifyMatrix,
flatten = flatten, ...)
10: fromJSON(self$url("/json/version"))
9: initialize(...)
8: Chromote$new()
7: set_default_chromote_object(Chromote$new())
6: default_chromote_object()
5: (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744,
selector = NULL, cliprect = NULL, expand = NULL, delay = 0.2,
zoom = 1, useragent = NULL, max_concurrent = getOption("webshot.concurrent",
default = 6))
{
if (length(url) == 0) {
stop("Need url.")
}
url <- vapply(url, function(x) {
if (!is_url(x)) {
file_url(x)
}
else {
x
}
}, character(1))
if (!is.null(cliprect) && !is.list(cliprect))
cliprect <- list(cliprect)
if (!is.null(selector) && !is.list(selector))
selector <- list(selector)
...
4: do.call(webshot2::webshot, args[ws_args])
3: withCallingHandlers(expr, message = function(c) if (inherits(c,
classes)) tryInvokeRestart("muffleMessage"))
2: suppressMessages(do.call(webshot2::webshot, args[ws_args]))
1: mapshot(x = tst_mv, file = paste0(getwd(), "/test.png"))`
Webshot2::webshot does not work whereas webshot::webshot does.
I think it is perhaps proxy related (I have same kind of problem with pagedown and make multiple tests with cromote etc.... The problem only affects people with authenticated proxies).
@sylvaine31 are you able to write to tempfile()?
@tim-salabim I'm able to write in tempfile : txtPath <- tempfile(fileext = ".txt") writeLines(text = "Hello, World!", con = txtPath) readLines(txtPath)
[1] "Hello, World!"
Hi all, I'm still puzzled as to why this fails for some people. Could you please do me the favour and run the following reprex (using reprex::reprex())?
library(leaflet)
library(mapview)
library(webshot)
#> Registered S3 method overwritten by 'webshot':
#> method from
#> print.webshot webshot2
library(htmlwidgets)
library(magick)
#> Linking to ImageMagick 6.9.10.23
#> Enabled features: fontconfig, freetype, fftw, lcms, pango, webp, x11
#> Disabled features: cairo, ghostscript, heic, raw, rsvg
#> Using 4 threads
m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addCircleMarkers(data = breweries)
m
#> `google-chrome` and `chromium-browser` were not found. Try setting the CHROMOTE_CHROME environment variable or adding one of these executables to your PATH.

htmlfl = tempfile(fileext = ".html")
htmlfl
#> [1] "/tmp/Rtmp7U3smz/file52ef1e52ef43.html"
pngfl1 = tempfile(fileext = ".png")
pngfl1
#> [1] "/tmp/Rtmp7U3smz/file52ef387802b6.png"
pngfl2 = tempfile(fileext = ".png")
pngfl2
#> [1] "/tmp/Rtmp7U3smz/file52ef2254904a.png"
saveWidget(m, file = htmlfl)
# browseURL(htmlfl)
mapshot(m, file = pngfl1, debug=T)
#> [36m[info][0m [phantom] Starting...
#> [36m[info][0m [phantom] Running suite: 1 step
#> [32;1m[debug][0m [phantom] Successfully injected Casper client-side utilities
#> [36m[info][0m [phantom] Step anonymous 1/1: done in 27ms.
#> [36m[info][0m [phantom] Step anonymous 2/2: done in 44ms.
#> [36m[info][0m [phantom] Step _step 3/7: done in 64ms.
#> [32;1m[debug][0m [phantom] opening url: /tmp/Rtmp7U3smz/file52ef75c50e50.html, HTTP GET
#> [32;1m[debug][0m [phantom] Navigation requested: url=file:///tmp/Rtmp7U3smz/file52ef75c50e50.html, type=Other, willNavigate=true, isMainFrame=true
#> [32;1m[debug][0m [phantom] url changed to "file:///tmp/Rtmp7U3smz/file52ef75c50e50.html"
#> [32;1m[debug][0m [phantom] Successfully injected Casper client-side utilities
#> [36m[info][0m [phantom] Step _step 5/7: done in 642ms.
#> [36m[info][0m [phantom] wait() finished waiting for 200ms.
#> [36m[info][0m [phantom] Step anonymous 6/7: done in 863ms.
#> [32;1m[debug][0m [phantom] Capturing page to /tmp/Rtmp7U3smz/file52ef387802b6.png
#> [36m[info][0m [phantom] Capture saved to /tmp/Rtmp7U3smz/file52ef387802b6.png
#> [36m[info][0m [phantom] Step anonymous 7/7: done in 1235ms.
#> [36m[info][0m [phantom] Done 7 steps in 1237ms
#> [32;1m[debug][0m [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true
#> [32;1m[debug][0m [phantom] url changed to "about:blank"
img1 = magick::image_read(pngfl1)
plot(img1)

webshot::webshot(url = htmlfl, file = pngfl2, debug=T)
#> [36m[info][0m [phantom] Starting...
#> [36m[info][0m [phantom] Running suite: 1 step
#> [32;1m[debug][0m [phantom] Successfully injected Casper client-side utilities
#> [36m[info][0m [phantom] Step anonymous 1/1: done in 27ms.
#> [36m[info][0m [phantom] Step anonymous 2/2: done in 44ms.
#> [36m[info][0m [phantom] Step _step 3/7: done in 64ms.
#> [32;1m[debug][0m [phantom] opening url: /tmp/Rtmp7U3smz/file52ef1e52ef43.html, HTTP GET
#> [32;1m[debug][0m [phantom] Navigation requested: url=file:///tmp/Rtmp7U3smz/file52ef1e52ef43.html, type=Other, willNavigate=true, isMainFrame=true
#> [32;1m[debug][0m [phantom] url changed to "file:///tmp/Rtmp7U3smz/file52ef1e52ef43.html"
#> [32;1m[debug][0m [phantom] Successfully injected Casper client-side utilities
#> [36m[info][0m [phantom] Step _step 5/7: done in 640ms.
#> [36m[info][0m [phantom] wait() finished waiting for 200ms.
#> [36m[info][0m [phantom] Step anonymous 6/7: done in 846ms.
#> [32;1m[debug][0m [phantom] Capturing page to /tmp/Rtmp7U3smz/file52ef2254904a.png
#> [36m[info][0m [phantom] Capture saved to /tmp/Rtmp7U3smz/file52ef2254904a.png
#> [36m[info][0m [phantom] Step anonymous 7/7: done in 1189ms.
#> [36m[info][0m [phantom] Done 7 steps in 1190ms
#> [32;1m[debug][0m [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true
#> [32;1m[debug][0m [phantom] url changed to "about:blank"

img2 = magick::image_read(pngfl2)
plot(img2)

Created on 2022-07-02 by the reprex package (v2.0.1)
I am currently contemplating to have two different functions:
- mapshot - using webshot::webshot()
- mapshot2 - using webshot2::webshot()
The other option would be to introduce a switch in mapshot() and have an option which one to use by default.
Any preferences?
library(leaflet)
library(mapview)
library(webshot)
library(htmlwidgets)
library(magick)
#> Linking to ImageMagick 6.9.12.3
#> Enabled features: cairo, fontconfig, freetype, heic, lcms, pango, raw, rsvg, webp
#> Disabled features: fftw, ghostscript, x11
m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addCircleMarkers(data = breweries)
m

htmlfl = tempfile(fileext = ".html")
htmlfl
#> [1] "/var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T//RtmpQkR0ws/file6ee0775967b5.html"
pngfl1 = tempfile(fileext = ".png")
pngfl1
#> [1] "/var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T//RtmpQkR0ws/file6ee0ea7d94a.png"
pngfl2 = tempfile(fileext = ".png")
pngfl2
#> [1] "/var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T//RtmpQkR0ws/file6ee02daa90ca.png"
saveWidget(m, file = htmlfl)
mapshot(m, file = pngfl1, debug=T)
#> [36m[info][0m [phantom] Starting...
#> [36m[info][0m [phantom] Running suite: 1 step
#> [32;1m[debug][0m [phantom] Successfully injected Casper client-side utilities
#> [36m[info][0m [phantom] Step anonymous 1/1: done in 36ms.
#> [36m[info][0m [phantom] Step anonymous 2/2: done in 54ms.
#> [36m[info][0m [phantom] Step _step 3/7: done in 77ms.
#> [32;1m[debug][0m [phantom] opening url: /var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T//RtmpQkR0ws/file6ee034891a47.html, HTTP GET
#> [32;1m[debug][0m [phantom] Navigation requested: url=file:///var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T/RtmpQkR0ws/file6ee034891a47.html, type=Other, willNavigate=true, isMainFrame=true
#> [32;1m[debug][0m [phantom] url changed to "file:///var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T/RtmpQkR0ws/file6ee034891a47.html"
#> [32;1m[debug][0m [phantom] Successfully injected Casper client-side utilities
#> [36m[info][0m [phantom] Step _step 5/7: done in 545ms.
#> [36m[info][0m [phantom] wait() finished waiting for 200ms.
#> [36m[info][0m [phantom] Step anonymous 6/7: done in 770ms.
#> [32;1m[debug][0m [phantom] Capturing page to /var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T/RtmpQkR0ws/file6ee0ea7d94a.png
#> [36m[info][0m [phantom] Capture saved to /var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T/RtmpQkR0ws/file6ee0ea7d94a.png
#> [36m[info][0m [phantom] Step anonymous 7/7: done in 1256ms.
#> [36m[info][0m [phantom] Done 7 steps in 1256ms
#> [32;1m[debug][0m [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true
#> [32;1m[debug][0m [phantom] url changed to "about:blank"
img1 = magick::image_read(pngfl1)
plot(img1)

webshot::webshot(url = htmlfl, file = pngfl2, debug=T)
#> [36m[info][0m [phantom] Starting...
#> [36m[info][0m [phantom] Running suite: 1 step
#> [32;1m[debug][0m [phantom] Successfully injected Casper client-side utilities
#> [36m[info][0m [phantom] Step anonymous 1/1: done in 35ms.
#> [36m[info][0m [phantom] Step anonymous 2/2: done in 54ms.
#> [36m[info][0m [phantom] Step _step 3/7: done in 73ms.
#> [32;1m[debug][0m [phantom] opening url: /var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T//RtmpQkR0ws/file6ee0775967b5.html, HTTP GET
#> [32;1m[debug][0m [phantom] Navigation requested: url=file:///var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T/RtmpQkR0ws/file6ee0775967b5.html, type=Other, willNavigate=true, isMainFrame=true
#> [32;1m[debug][0m [phantom] url changed to "file:///var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T/RtmpQkR0ws/file6ee0775967b5.html"
#> [32;1m[debug][0m [phantom] Successfully injected Casper client-side utilities
#> [36m[info][0m [phantom] Step _step 5/7: done in 520ms.
#> [36m[info][0m [phantom] wait() finished waiting for 200ms.
#> [36m[info][0m [phantom] Step anonymous 6/7: done in 740ms.
#> [32;1m[debug][0m [phantom] Capturing page to /var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T/RtmpQkR0ws/file6ee02daa90ca.png
#> [36m[info][0m [phantom] Capture saved to /var/folders/vy/14crg38n49s3y9gtyxqtpl480000gn/T/RtmpQkR0ws/file6ee02daa90ca.png
#> [36m[info][0m [phantom] Step anonymous 7/7: done in 1193ms.
#> [36m[info][0m [phantom] Done 7 steps in 1193ms
#> [32;1m[debug][0m [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true
#> [32;1m[debug][0m [phantom] url changed to "about:blank"

img2 = magick::image_read(pngfl2)
plot(img2)

Created on 2022-07-02 by the reprex package (v2.0.1)
Session info
sessionInfo()
#> R version 4.2.1 (2022-06-23)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur ... 10.16
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] magick_2.7.3 htmlwidgets_1.5.4 webshot_0.5.3 mapview_2.11.0
#> [5] leaflet_2.1.1
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.8.3 lattice_0.20-45 ps_1.7.1 png_0.1-7
#> [5] class_7.3-20 assertthat_0.2.1 digest_0.6.29 utf8_1.2.2
#> [9] mime_0.12 R6_2.5.1 reprex_2.0.1 stats4_4.2.1
#> [13] evaluate_0.15 e1071_1.7-11 httr_1.4.3 highr_0.9
#> [17] pillar_1.7.0 rlang_1.0.2 curl_4.3.2 rstudioapi_0.13
#> [21] callr_3.7.0 raster_3.5-21 rmarkdown_2.14 stringr_1.4.0
#> [25] munsell_0.5.0 proxy_0.4-27 compiler_4.2.1 xfun_0.31
#> [29] pkgconfig_2.0.3 base64enc_0.1-3 htmltools_0.5.2 tidyselect_1.1.2
#> [33] tibble_3.1.7 codetools_0.2-18 fansi_1.0.3 crayon_1.5.1
#> [37] dplyr_1.0.9 withr_2.5.0 sf_1.0-7 grid_4.2.1
#> [41] jsonlite_1.8.0 satellite_1.0.4 lifecycle_1.0.1 DBI_1.1.3
#> [45] magrittr_2.0.3 units_0.8-0 scales_1.2.0 KernSmooth_2.23-20
#> [49] cli_3.3.0 stringi_1.7.6 fs_1.5.2 sp_1.5-0
#> [53] xml2_1.3.3 ellipsis_0.3.2 generics_0.1.2 vctrs_0.4.1
#> [57] tools_4.2.1 leafem_0.2.0 glue_1.6.2 purrr_0.3.4
#> [61] crosstalk_1.2.0 processx_3.6.1 fastmap_1.1.0 yaml_2.3.5
#> [65] colorspace_2.0-3 terra_1.5-21 classInt_0.4-7 knitr_1.39
Thanks @markolipka
R-Studio non-admin mode
library(leaflet) #> Warning: package 'leaflet' was built under R version 4.1.3 library(mapview) library(webshot) #> Warning: package 'webshot' was built under R version 4.1.3 library(htmlwidgets) #> Warning: package 'htmlwidgets' was built under R version 4.1.3 library(magick) #> Warning: package 'magick' was built under R version 4.1.3 #> Linking to ImageMagick 6.9.12.3 #> Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp #> Disabled features: fontconfig, x11
m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addCircleMarkers(data = breweries)
m

htmlfl = tempfile(fileext = ".html") htmlfl #> [1] "C:\Users\a5187\AppData\Local\Temp\Rtmpg9QCwS\file53741c6b49ed.html"
pngfl1 = tempfile(fileext = ".png") pngfl1 #> [1] "C:\Users\a5187\AppData\Local\Temp\Rtmpg9QCwS\file537477983cd5.png"
pngfl2 = tempfile(fileext = ".png") pngfl2 #> [1] "C:\Users\a5187\AppData\Local\Temp\Rtmpg9QCwS\file537414b483c.png"
saveWidget(m, file = htmlfl)
mapshot(m, file = pngfl1, debug=T)
#> Error in c("process_initialize(self, private, command, args, stdin, stdout, ", : ! Native call to processx_exec failed
#> Caused by error in chain_call(c_processx_exec, command, c(command, args), pty, pty_options, ...:
#> ! create process 'C:\Users\a5187\AppData\Roaming/PhantomJS/phantomjs.exe' (system error 1260, This program is blocked by group policy. For more information, contact your system administrator.
#> ) @win/processx.c:1040 (processx_exec)
img1 = magick::image_read(pngfl1) #> Error in magick_image_readpath(path, density, depth, strip, defines): Rterm.exe: UnableToOpenBlob `C:\Users\a5187\AppData\Local\Temp\Rtmpg9QCwS\file537477983cd5.png': No such file or directory @ error/blob.c/OpenBlob/2924 plot(img1) #> Error in plot(img1): object 'img1' not found
htmlfl #> [1] "C:\Users\a5187\AppData\Local\Temp\Rtmpg9QCwS\file53741c6b49ed.html"
pngfl1 = tempfile(fileext = ".png") pngfl1 #> [1] "C:\Users\a5187\AppData\Local\Temp\Rtmpg9QCwS\file537450a73b6.png"
pngfl2 = tempfile(fileext = ".png") pngfl2 #> [1] "C:\Users\a5187\AppData\Local\Temp\Rtmpg9QCwS\file5374bbecfa.png"
saveWidget(m, file = htmlfl)
mapshot(m, file = pngfl1, debug=T)
#> Error in c("process_initialize(self, private, command, args, stdin, stdout, ", : ! Native call to processx_exec failed
#> Caused by error in chain_call(c_processx_exec, command, c(command, args), pty, pty_options, ...:
#> ! create process 'C:\Users\a5187\AppData\Roaming/PhantomJS/phantomjs.exe' (system error 1260, This program is blocked by group policy. For more information, contact your system administrator.
#> ) @win/processx.c:1040 (processx_exec)
img1 = magick::image_read(pngfl1) #> Error in magick_image_readpath(path, density, depth, strip, defines): Rterm.exe: UnableToOpenBlob `C:\Users\a5187\AppData\Local\Temp\Rtmpg9QCwS\file537450a73b6.png': No such file or directory @ error/blob.c/OpenBlob/2924 plot(img1) #> Error in plot(img1): object 'img1' not found
webshot::webshot(url = htmlfl, file = pngfl2, debug=T)
#> Error in c("process_initialize(self, private, command, args, stdin, stdout, ", : ! Native call to processx_exec failed
#> Caused by error in chain_call(c_processx_exec, command, c(command, args), pty, pty_options, ...:
#> ! create process 'C:\Users\a5187\AppData\Roaming/PhantomJS/phantomjs.exe' (system error 1260, This program is blocked by group policy. For more information, contact your system administrator.
#> ) @win/processx.c:1040 (processx_exec)
img2 = magick::image_read(pngfl2) #> Error in magick_image_readpath(path, density, depth, strip, defines): Rterm.exe: UnableToOpenBlob `C:\Users\a5187\AppData\Local\Temp\Rtmpg9QCwS\file5374bbecfa.png': No such file or directory @ error/blob.c/OpenBlob/2924 plot(img2) #> Error in plot(img2): object 'img2' not found Created on 2022-07-03 by the reprex package (v2.0.1)
Session info
> sessionInfo() R version 4.1.2 (2021-11-01) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043)Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] rstudioapi_0.13 knitr_1.39 magrittr_2.0.3 R6_2.5.1 rlang_1.0.2 fastmap_1.1.0
[7] fansi_1.0.3 highr_0.9 tools_4.1.2 xfun_0.31 utf8_1.2.2 cli_3.3.0
[13] clipr_0.8.0 withr_2.5.0 htmltools_0.5.2 ellipsis_0.3.2 yaml_2.3.5 digest_0.6.29
[19] tibble_3.1.7 lifecycle_1.0.1 crayon_1.5.1 processx_3.6.1 callr_3.7.0 ps_1.7.1
[25] vctrs_0.4.1 fs_1.5.2 glue_1.6.2 evaluate_0.15 rmarkdown_2.14 reprex_2.0.1
[31] compiler_4.1.2 pillar_1.7.0 pkgconfig_2.0.3
R-Studio admin mode
library(leaflet) #> Warning: package 'leaflet' was built under R version 4.1.3 library(mapview) library(webshot) #> Warning: package 'webshot' was built under R version 4.1.3 library(htmlwidgets) #> Warning: package 'htmlwidgets' was built under R version 4.1.3 library(magick) #> Warning: package 'magick' was built under R version 4.1.3 #> Linking to ImageMagick 6.9.12.3 #> Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp #> Disabled features: fontconfig, x11
m <- leaflet() %>% addTiles() %>% # Add default OpenStreetMap map tiles addCircleMarkers(data = breweries) m #> Error in s$close(): attempt to apply non-function
htmlfl = tempfile(fileext = ".html") htmlfl #> [1] "C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file41805f155602.html"
pngfl1 = tempfile(fileext = ".png") pngfl1 #> [1] "C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file41803ba46579.png"
pngfl2 = tempfile(fileext = ".png") pngfl2 #> [1] "C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file418013a528f.png"
saveWidget(m, file = htmlfl)
mapshot(m, file = pngfl1, debug=T) #> [info] [phantom] Starting... #> [info] [phantom] Running suite: 1 step #> [debug] [phantom] Successfully injected Casper client-side utilities #> [info] [phantom] Step anonymous 1/1: done in 54ms. #> [info] [phantom] Step anonymous 2/2: done in 55ms. #> [info] [phantom] Step _step 3/7: done in 75ms. #> [debug] [phantom] opening url: C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file4180665e6a00.html, HTTP GET #> [debug] [phantom] Navigation requested: url=c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmpkhZ7Pq%5Cfile4180665e6a00.html, type=Other, willNavigate=true, isMainFrame=true #> [warning] [phantom] Loading resource failed with status=fail: c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmpkhZ7Pq%5Cfile4180665e6a00.html #> Could not load c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmpkhZ7Pq%5Cfile4180665e6a00.html #> [debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true #> [debug] [phantom] url changed to "about:blank" #> Error in (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744, : webshot.js returned failure value: 1
img1 = magick::image_read(pngfl1) #> Error in magick_image_readpath(path, density, depth, strip, defines): Rterm.exe: UnableToOpenBlob `C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file41803ba46579.png': No such file or directory @ error/blob.c/OpenBlob/2924 plot(img1) #> Error in plot(img1): object 'img1' not found
htmlfl #> [1] "C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file41805f155602.html"
pngfl1 = tempfile(fileext = ".png") pngfl1 #> [1] "C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file41806691d0d.png"
pngfl2 = tempfile(fileext = ".png") pngfl2 #> [1] "C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file418044286ec0.png"
saveWidget(m, file = htmlfl)
mapshot(m, file = pngfl1, debug=T) #> [info] [phantom] Starting... #> [info] [phantom] Running suite: 1 step #> [debug] [phantom] Successfully injected Casper client-side utilities #> [info] [phantom] Step anonymous 1/1: done in 54ms. #> [info] [phantom] Step anonymous 2/2: done in 55ms. #> [info] [phantom] Step _step 3/7: done in 75ms. #> [debug] [phantom] opening url: C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file4180665e6a00.html, HTTP GET #> [debug] [phantom] Navigation requested: url=c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmpkhZ7Pq%5Cfile4180665e6a00.html, type=Other, willNavigate=true, isMainFrame=true #> [warning] [phantom] Loading resource failed with status=fail: c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmpkhZ7Pq%5Cfile4180665e6a00.html #> Could not load c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmpkhZ7Pq%5Cfile4180665e6a00.html #> [debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true #> [debug] [phantom] url changed to "about:blank" #> Error in (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744, : webshot.js returned failure value: 1
img1 = magick::image_read(pngfl1) #> Error in magick_image_readpath(path, density, depth, strip, defines): Rterm.exe: UnableToOpenBlob `C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file41806691d0d.png': No such file or directory @ error/blob.c/OpenBlob/2924 plot(img1) #> Error in plot(img1): object 'img1' not found
webshot::webshot(url = htmlfl, file = pngfl2, debug=T) #> [info] [phantom] Starting... #> [info] [phantom] Running suite: 1 step #> [debug] [phantom] Successfully injected Casper client-side utilities #> [info] [phantom] Step anonymous 1/1: done in 35ms. #> [info] [phantom] Step anonymous 2/2: done in 48ms. #> [info] [phantom] Step _step 3/7: done in 68ms. #> [debug] [phantom] opening url: C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file41805f155602.html, HTTP GET #> [debug] [phantom] Navigation requested: url=c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmpkhZ7Pq%5Cfile41805f155602.html, type=Other, willNavigate=true, isMainFrame=true #> [warning] [phantom] Loading resource failed with status=fail: c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmpkhZ7Pq%5Cfile41805f155602.html #> Could not load c:%5CUsers%5CADMINI~1%5CAppData%5CLocal%5CTemp%5CRtmpkhZ7Pq%5Cfile41805f155602.html #> [debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true #> [debug] [phantom] url changed to "about:blank" #> Error in webshot::webshot(url = htmlfl, file = pngfl2, debug = T): webshot.js returned failure value: 1
img2 = magick::image_read(pngfl2) #> Error in magick_image_readpath(path, density, depth, strip, defines): Rterm.exe: UnableToOpenBlob `C:\Users\ADMINI~1\AppData\Local\Temp\RtmpkhZ7Pq\file418044286ec0.png': No such file or directory @ error/blob.c/OpenBlob/2924 plot(img2) #> Error in plot(img2): object 'img2' not found Created on 2022-07-03 by the reprex package (v2.0.1)
Session info
> sessionInfo() R version 4.1.2 (2021-11-01) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043)Matrix products: default
locale:
[1] LC_COLLATE=Norwegian Bokmål_Norway.1252 LC_CTYPE=Norwegian Bokmål_Norway.1252
[3] LC_MONETARY=Norwegian Bokmål_Norway.1252 LC_NUMERIC=C
[5] LC_TIME=Norwegian Bokmål_Norway.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] rstudioapi_0.13 knitr_1.39 magrittr_2.0.3 R6_2.5.1 rlang_1.0.2
[6] fastmap_1.1.0 fansi_1.0.3 highr_0.9 tools_4.1.2 xfun_0.31
[11] utf8_1.2.2 cli_3.3.0 clipr_0.8.0 withr_2.5.0 htmltools_0.5.2
[16] ellipsis_0.3.2 yaml_2.3.5 digest_0.6.29 tibble_3.1.7 lifecycle_1.0.1
[21] crayon_1.5.1 processx_3.6.1 callr_3.7.0 ps_1.7.1 vctrs_0.4.1
[26] fs_1.5.2 glue_1.6.2 evaluate_0.15 rmarkdown_2.14 reprex_2.0.1
[31] compiler_4.1.2 pillar_1.7.0 pkgconfig_2.0.3
@niknikos thanks for these. I should have said to use the reprex with the current version of the main branch, not the feature branch. Can you rerun after
remotes::install_github("r-spatial/mapview")
?
@tim-salabim sorry about that. I have now updated my previous post with the output based on
remotes::install_github("r-spatial/mapview")
@niknikos it's my first time to try the reprex package and unfortunately it didn't work for me. Your example works fine for me until:
mapshot(m, file = pngfl1, debug=T) [info] [phantom] Starting... [info] [phantom] Running suite: 1 step [debug] [phantom] Successfully injected Casper client-side utilities [info] [phantom] Step anonymous 1/1: done in 37ms. [info] [phantom] Step anonymous 2/2: done in 49ms. [info] [phantom] Step _step 3/7: done in 69ms. [debug] [phantom] opening url: C:\Users\kkueth\AppData\Local\Temp\RtmpC0MHix\file3124298d2947.html, HTTP GET [debug] [phantom] Navigation requested: url=c:%5CUsers%5Ckkueth%5CAppData%5CLocal%5CTemp%5CRtmpC0MHix%5Cfile3124298d2947.html, type=Other, willNavigate=true, isMainFrame=true [warning] [phantom] Loading resource failed with status=fail: c:%5CUsers%5Ckkueth%5CAppData%5CLocal%5CTemp%5CRtmpC0MHix%5Cfile3124298d2947.html Could not load c:%5CUsers%5Ckkueth%5CAppData%5CLocal%5CTemp%5CRtmpC0MHix%5Cfile3124298d2947.html [debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true [debug] [phantom] url changed to "about:blank" Error in (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744, : webshot.js returned failure value: 1 img1 = magick::image_read(pngfl1) Error in magick_image_readpath(path, density, depth, strip, defines) : rsession-utf8.exe: UnableToOpenBlob `C:\Users\kkueth\AppData\Local\Temp\RtmpC0MHix\file312450cb379d.png': No such file or directory @ error/blob.c/OpenBlob/2924 plot(img1) Error in plot(img1) : object 'img1' not found webshot::webshot(url = htmlfl, file = pngfl2, debug=T) [info] [phantom] Starting... [info] [phantom] Running suite: 1 step [debug] [phantom] Successfully injected Casper client-side utilities [info] [phantom] Step anonymous 1/1: done in 37ms. [info] [phantom] Step anonymous 2/2: done in 50ms. [info] [phantom] Step _step 3/7: done in 69ms. [debug] [phantom] opening url: C:\Users\kkueth\AppData\Local\Temp\RtmpC0MHix\file31245325565f.html, HTTP GET [debug] [phantom] Navigation requested: url=c:%5CUsers%5Ckkueth%5CAppData%5CLocal%5CTemp%5CRtmpC0MHix%5Cfile31245325565f.html, type=Other, willNavigate=true, isMainFrame=true [warning] [phantom] Loading resource failed with status=fail: c:%5CUsers%5Ckkueth%5CAppData%5CLocal%5CTemp%5CRtmpC0MHix%5Cfile31245325565f.html Could not load c:%5CUsers%5Ckkueth%5CAppData%5CLocal%5CTemp%5CRtmpC0MHix%5Cfile31245325565f.html [debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true [debug] [phantom] url changed to "about:blank" Error in webshot::webshot(url = htmlfl, file = pngfl2, debug = T) : webshot.js returned failure value: 1
img2 = magick::image_read(pngfl2) Error in magick_image_readpath(path, density, depth, strip, defines) : rsession-utf8.exe: UnableToOpenBlob `C:\Users\kkueth\AppData\Local\Temp\RtmpC0MHix\file3124711b6cb2.png': No such file or directory @ error/blob.c/OpenBlob/2924 plot(img2) Error in plot(img2) : object 'img2' not found
Sorry for this "ugly" code. I would love to find out how reprex works in future. For me mapshot creates the same error here, as before: Error in (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744, : webshot.js returned failure value: 1
@KathaRRRina perhaps this https://teachdatascience.com/reprex/ can be of help. Particularly the Copy and paste section.
I have encountered the same problem. The problem is when you call the webshot::webshot but it cannot return the correct path style in windows system. '\' >>> '%5C'. I have no idea if you have right to fix webshot::webshot directly but.... that it. I hope this can be fixed as soon as possible.
Also having this issue and where it saves the .html file fine, it fails to takes a snapshot of the html using webshot() for the png output. This is the error I am getting (I replaced my username but it does find the correct path as I found the file myself):
Could not load c:%5CUsers%5CXXXYYYZZZ%5CAppData%5CLocal%5CTemp%5CRtmp2twFvl%5Cfile54e02ddf6a28.html
Error in (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744, :
webshot.js returned failure value: 1
So perhaps as @EmsAlan mentioned, it might be to do with the replacement of backslashes to %5C?
EDIT: I managed to use the combination of webshot::mapshot() and webshot2:webshot() to output a png. I first save the .html file to a specified file location using mapshot and then I load it as the url in the webshot function. Bit of a workaround but at least it works for now.