rstudio / leaflet

R Interface to Leaflet Maps
http://rstudio.github.io/leaflet/
Other
809 stars 507 forks source link

Leaflet map works in RStudio View, but hangs in browser. #645

Closed zlehmann closed 5 years ago

zlehmann commented 5 years ago

Code here:

Column {data-width=600}
-----------------------------------------------------------------------

### Map

```{r}
m <- leaflet() %>% addTiles() %>% setView(lat=25, lng=55, zoom=10)
m


If i add the m lines into the console, I can get the map to display in the Viewer just fine. When I try to knit this code it just hangs with the loading bar running endlessly. I had leaflet map working earlier today, I swear I didn't change any code and suddenly I have these symptoms. No idea what the problem could be. I restarted computer, Moved code to new directory, reinstalled all my packages. Nothing works. I'm new to RStudio so let me know what additional information might be useful.
schloerke commented 5 years ago

Hi @zlehmann !

Yes, this is unexpected.

Do you mind sharing the top part of your document? It would be good to have the full yaml header to know what params and document type you used. I'm guessing flexdashboard, but I want to be sure.

zlehmann commented 5 years ago

Hi @schloerke Here is my header:

---
title: "SDE Test"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(leaflet)
library(rgdal)
library(ggmap)
library(httr)
library(leaflet.esri)

options(scipen=999)
zlehmann commented 5 years ago

I can also confirm that my file works on other machines. It is something specific to my computer apparently.

schloerke commented 5 years ago

Hmmmm. I am getting the forever loading bar as well.

This is specific to RStudio IDE, I believe. If you run rmarkdown::render("FILE.rmd"); browseURL("FILE.html"), it should work as expected.

I'll investigate some more here.

schloerke commented 5 years ago

@zlehmann Inside your RStudio session, may I have the output of sessioninfo::session_info()?

zlehmann commented 5 years ago

If I run rmarkdown::render I get the following pandoc error:

output file: SDE_Test.knit.md

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS SDE_Test.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output SDE_Test.html --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\ZLEHMANN\Documents\R\R-3.6.1\library\flexdashboard\rmarkdown\templates\flex_dashboard\resources\default.html" --id-prefix section- --variable "theme:cosmo" --include-in-header "C:\Users\ZLEHMANN\AppData\Local\Temp\RtmpO4MQJp\rmarkdown-str32d0648e5098.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\ZLEHMANN\AppData\Local\Temp\RtmpO4MQJp\file32d01ee55326html" --highlight-style pygments --include-before-body "C:\Users\ZLEHMANN\AppData\Local\Temp\RtmpO4MQJp\file32d02cae7047.html" --include-after-body "C:\Users\ZLEHMANN\AppData\Local\Temp\RtmpO4MQJp\file32d09e33a80.html" 
pandoc.exe: SDE_Test.utf8.md: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1
zlehmann commented 5 years ago

Session Info:

- Session info --------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United States.1252  
 ctype    English_United States.1252  
 tz       America/New_York            
 date     2019-10-08                  

- Packages ------------------------------------------------------------------------------------------------------------------------------
 package        * version date       lib source                          
 assertthat       0.2.1   2019-03-21 [1] CRAN (R 3.6.1)                  
 backports        1.1.5   2019-10-02 [1] CRAN (R 3.6.1)                  
 bitops           1.0-6   2013-08-17 [1] CRAN (R 3.6.0)                  
 broom            0.5.2   2019-04-07 [1] CRAN (R 3.6.1)                  
 cellranger       1.1.0   2016-07-27 [1] CRAN (R 3.6.1)                  
 cli              1.1.0   2019-03-19 [1] CRAN (R 3.6.1)                  
 colorspace       1.4-1   2019-03-18 [1] CRAN (R 3.6.1)                  
 crayon           1.3.4   2017-09-16 [1] CRAN (R 3.6.1)                  
 crosstalk        1.0.0   2016-12-21 [1] CRAN (R 3.6.1)                  
 curl             4.0     2019-07-22 [1] CRAN (R 3.6.1)                  
 digest           0.6.21  2019-09-20 [1] CRAN (R 3.6.1)                  
 dplyr          * 0.8.3   2019-07-04 [1] CRAN (R 3.6.1)                  
 evaluate         0.14    2019-05-28 [1] CRAN (R 3.6.1)                  
 flexdashboard  * 0.5.1.1 2018-06-29 [1] CRAN (R 3.6.1)                  
 forcats        * 0.4.0   2019-02-17 [1] CRAN (R 3.6.1)                  
 generics         0.0.2   2018-11-29 [1] CRAN (R 3.6.1)                  
 ggmap          * 3.0.0   2019-02-04 [1] CRAN (R 3.6.1)                  
 ggplot2        * 3.2.1   2019-08-10 [1] CRAN (R 3.6.1)                  
 glue             1.3.1   2019-03-12 [1] CRAN (R 3.6.1)                  
 gtable           0.3.0   2019-03-25 [1] CRAN (R 3.6.1)                  
 haven            2.1.1   2019-07-04 [1] CRAN (R 3.6.1)                  
 hms              0.5.0   2019-07-09 [1] CRAN (R 3.6.1)                  
 htmltools        0.3.6   2017-04-28 [1] CRAN (R 3.6.1)                  
 htmlwidgets      1.5     2019-10-04 [1] CRAN (R 3.6.1)                  
 httpuv           1.5.2   2019-09-11 [1] CRAN (R 3.6.1)                  
 httr           * 1.4.1   2019-08-05 [1] CRAN (R 3.6.1)                  
 jpeg             0.1-8   2014-01-23 [1] CRAN (R 3.6.0)                  
 jsonlite         1.6     2018-12-07 [1] CRAN (R 3.6.1)                  
 knitr            1.24    2019-08-08 [1] CRAN (R 3.6.1)                  
 later            0.8.0   2019-02-11 [1] CRAN (R 3.6.1)                  
 lattice          0.20-38 2018-11-04 [1] CRAN (R 3.6.1)                  
 lazyeval         0.2.2   2019-03-15 [1] CRAN (R 3.6.1)                  
 leaflet        * 2.0.2   2019-10-07 [1] Github (rstudio/leaflet@18ec981)
 leaflet.esri   * 1.0.0   2018-04-23 [1] CRAN (R 3.6.1)                  
 leaflet.extras * 1.0.0   2018-04-21 [1] CRAN (R 3.6.1)                  
 lubridate        1.7.4   2018-04-11 [1] CRAN (R 3.6.1)                  
 magrittr         1.5     2014-11-22 [1] CRAN (R 3.6.1)                  
 mime             0.7     2019-06-11 [1] CRAN (R 3.6.0)                  
 modelr           0.1.5   2019-08-08 [1] CRAN (R 3.6.1)                  
 munsell          0.5.0   2018-06-12 [1] CRAN (R 3.6.1)                  
 nlme             3.1-141 2019-08-01 [1] CRAN (R 3.6.1)                  
 pillar           1.4.2   2019-06-29 [1] CRAN (R 3.6.1)                  
 pkgconfig        2.0.3   2019-09-22 [1] CRAN (R 3.6.1)                  
 plyr             1.8.4   2016-06-08 [1] CRAN (R 3.6.1)                  
 png              0.1-7   2013-12-03 [1] CRAN (R 3.6.0)                  
 promises         1.0.1   2018-04-13 [1] CRAN (R 3.6.1)                  
 purrr          * 0.3.2   2019-03-15 [1] CRAN (R 3.6.1)                  
 R6               2.4.0   2019-02-14 [1] CRAN (R 3.6.1)                  
 Rcpp             1.0.2   2019-07-25 [1] CRAN (R 3.6.1)                  
 readr          * 1.3.1   2018-12-21 [1] CRAN (R 3.6.1)                  
 readxl           1.3.1   2019-03-13 [1] CRAN (R 3.6.1)                  
 rgdal          * 1.4-4   2019-05-29 [1] CRAN (R 3.6.1)                  
 RgoogleMaps      1.4.4   2019-08-20 [1] CRAN (R 3.6.1)                  
 rjson            0.2.20  2018-06-08 [1] CRAN (R 3.6.0)                  
 rlang            0.4.0   2019-06-25 [1] CRAN (R 3.6.1)                  
 rmarkdown        1.14    2019-07-12 [1] CRAN (R 3.6.1)                  
 rstudioapi       0.10    2019-03-19 [1] CRAN (R 3.6.1)                  
 rvest            0.3.4   2019-05-15 [1] CRAN (R 3.6.1)                  
 scales           1.0.0   2018-08-09 [1] CRAN (R 3.6.1)                  
 sessioninfo      1.1.1   2018-11-05 [1] CRAN (R 3.6.1)                  
 shiny            1.3.2   2019-04-22 [1] CRAN (R 3.6.1)                  
 sp             * 1.3-1   2018-06-05 [1] CRAN (R 3.6.1)                  
 stringi          1.4.3   2019-03-12 [1] CRAN (R 3.6.0)                  
 stringr        * 1.4.0   2019-02-10 [1] CRAN (R 3.6.1)                  
 tibble         * 2.1.3   2019-06-06 [1] CRAN (R 3.6.1)                  
 tidyr          * 0.8.3   2019-03-01 [1] CRAN (R 3.6.1)                  
 tidyselect       0.2.5   2018-10-11 [1] CRAN (R 3.6.1)                  
 tidyverse      * 1.2.1   2017-11-14 [1] CRAN (R 3.6.1)                  
 vctrs            0.2.0   2019-07-05 [1] CRAN (R 3.6.1)                  
 withr            2.1.2   2018-03-15 [1] CRAN (R 3.6.1)                  
 xfun             0.10    2019-10-01 [1] CRAN (R 3.6.1)                  
 xml2             1.2.2   2019-08-09 [1] CRAN (R 3.6.1)                  
 xtable           1.8-4   2019-04-21 [1] CRAN (R 3.6.1)                  
 yaml             2.2.0   2018-07-25 [1] CRAN (R 3.6.0)                  
 zeallot          0.1.0   2018-01-28 [1] CRAN (R 3.6.1)                  

[1] C:/Users/ZLEHMANN/Documents/R/R-3.6.1/library
schloerke commented 5 years ago

Oh! You're on the bleeding edge / caught us in the middle of package deployments.

There's a hotfix coming out in htmlwidgets. It was submitted last night to CRAN.

To get you moving today, remotes::install_github("ramnathv/htmlwidgets"). Maybe at the end of the week, remove and install from CRAN: remove.packages("htmlwidgets"); install.packages("htmlwidgets").


Please install from github and let me know how it works for you.

zlehmann commented 5 years ago

That did it! Thank you so much!

schloerke commented 5 years ago

@zlehmann htmlwidgets 1.5.1 is on CRAN now. 😃