首页 > 解决方案 > Shiny Update Windows 10:无法从本地加载资源 img src

问题描述

我正在使用安装了本地 R/RStudio 的 Windows 10。几天后,我又将 R 更新到 v3.5.3,将 RStudio 更新到 v1.2.1330。几天后,我没有立即检查我的应用程序。同时,我必须安装许多 Julia/Atom-Juno 软件包进行培训,现在当我(本地)运行我正在开发的应用程序时,所有图像都消失了。 https://github.com/phileas-condemine/carto_indicateurs 该应用程序看起来像这样:https ://drees.shinyapps.io/Cartographie_des_indicateurs/ (我没有尝试重新部署,即使作为另一个操作系统它可能仍然有效)

这是一个简单的代表

在 app.R 中(在 RStudio 项目中运行)

library(shiny)
download.file(url = "https://www.rstudio.com/wp-content/uploads/2019/03/RStudio-Logo-Blue-Gray-125.png",
              destfile = "www/rstudio.png",mode = "wb")#I have to add this for windows 10
shinyApp(
  ui = fluidPage(
    tags$img(src="https://www.rstudio.com/wp-content/uploads/2019/03/RStudio-Logo-Blue-Gray-125.png"),
    tags$img(src="rstudio.png")
  ),
  server = function(input, output) { }
)

本地图像不渲染,而是我有一个损坏的图像。(我从 URL 得到的那个是好的)当我打开 Chrome 检查器并检查 JS 控制台时,我有以下错误

Failed to load resource: the server responded with a status of 404 (Not Found)rstudio.png:1

我试图用最新的摇杆/rstudio 图像检查 reprex,但我无法重现它。可能是因为这是与 Windows 10 相关的问题。

这是我的 sessionInfo()

R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252 
[2] LC_CTYPE=French_France.1252   
[3] LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics 
[3] grDevices utils    
[5] datasets  methods  
[7] base     

other attached packages:
[1] shiny_1.3.1

loaded via a namespace (and not attached):
 [1] compiler_3.5.3 
 [2] magrittr_1.5   
 [3] R6_2.4.0       
 [4] promises_1.0.1 
 [5] later_0.8.0    
 [6] htmltools_0.3.6
 [7] tools_3.5.3    
 [8] Rcpp_1.0.1     
 [9] jsonlite_1.6   
[10] digest_0.6.18  
[11] xtable_1.8-3   
[12] httpuv_1.5.1   
[13] mime_0.6  

我尝试重新安装 R v3.5.3 和最新的 RStudio v1.2.1335,它没有修复它。

最让我困扰的是,一些应用程序可以毫无问题地渲染所有图像。例如,这个工作正常:https ://github.com/phileas-condemine/trafic_dataviz.drees 是因为依赖关系以某种方式修复它吗?

标签: rshiny

解决方案


回到闪亮的 1.2.0 & R 3.5.2 修复了问题,所有图像都正确显示。所以“错误”要么来自闪亮的 1.3.1 要么来自 R 3.5.3

R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252 
[2] LC_CTYPE=French_France.1252   
[3] LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics 
[3] grDevices utils    
[5] datasets  methods  
[7] base     

other attached packages:
 [1] bsplus_0.1.1         
 [2] shinycssloaders_0.2.0
 [3] markdown_0.9         
 [4] stringr_1.3.1        
 [5] shinyBS_0.61         
 [6] shinydashboard_0.7.1 
 [7] shinyjs_1.0          
 [8] V8_2.2               
 [9] shinyWidgets_0.4.4   
[10] DT_0.5               
[11] data.table_1.12.0    
[12] dplyr_0.7.8          
[13] shiny_1.2.0          

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0      
 [2] pillar_1.3.1    
 [3] compiler_3.5.2  
 [4] later_0.8.0     
 [5] bindr_0.1.1     
 [6] tools_3.5.2     
 [7] digest_0.6.18   
 [8] packrat_0.5.0   
 [9] lubridate_1.7.4 
[10] jsonlite_1.6    
[11] tibble_2.0.1    
[12] pkgconfig_2.0.2 
[13] rlang_0.3.1     
[14] rstudioapi_0.9.0
[15] crosstalk_1.0.0 
[16] yaml_2.2.0      
[17] curl_3.3        
[18] bindrcpp_0.2.2  
[19] htmlwidgets_1.3 
[20] tidyselect_0.2.5
[21] glue_1.3.0      
[22] R6_2.3.0        
[23] purrr_0.3.0     
[24] magrittr_1.5    
[25] scales_1.0.0    
[26] promises_1.0.1  
[27] htmltools_0.3.6 
[28] assertthat_0.2.0
[29] mime_0.6        
[30] xtable_1.8-3    
[31] colorspace_1.4-0
[32] httpuv_1.5.1    
[33] stringi_1.2.4   
[34] munsell_0.5.0   
[35] crayon_1.3.4    

推荐阅读