此应用程序可以在本地运行,但部署到闪亮的服务器时则无法运行。
library(shiny)
library(digest)
library(reactable)
ui <- fluidPage(
mainPanel(
reactableOutput("rt")
)
)
server <- function(input, output) {
output$rt <- renderReactable({
rmt <- reactable(mtcars[1:3,],
columns = list(
mpg = colDef(footer = 'A')
))
print(digest(rmt))
print(sessionInfo())
return(rmt)
})
}
shinyApp(ui = ui, server = server)
问题出在页脚上。 注释掉它,它就可以在 Shiny 服务器上运行了。
本地控制台输出:
[1] "7f47b0250877eacd853d20e019725e8f"
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 LC_NUMERIC=C LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] reactable_0.4.4 digest_0.6.36 shiny_1.8.1.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.12 rstudioapi_0.16.0 magrittr_2.0.3 xtable_1.8-4 R6_2.5.1 rlang_1.1.4 fastmap_1.2.0 tools_4.2.1 cli_3.6.3 jquerylib_0.1.4 withr_3.0.0 htmltools_0.5.8.1 yaml_2.3.10 lifecycle_1.0.4
[15] later_1.3.2 sass_0.4.9 htmlwidgets_1.6.4 promises_1.3.0 rsconnect_1.3.1 memoise_2.0.1 cachem_1.1.0 mime_0.12 reactR_0.6.0 compiler_4.2.1 bslib_0.7.0 jsonlite_1.8.8 httpuv_1.6.15 renv_1.0.7
闪亮的服务器日志:(我删除了时间戳)
[1] "7f47b0250877eacd853d20e019725e8f"
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux
Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.3.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reactable_0.4.4 digest_0.6.36 shiny_1.8.1.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.12 withr_3.0.0 later_1.3.2 mime_0.12
[5] reactR_0.6.0 R6_2.5.1 jsonlite_1.8.8 lifecycle_1.0.4
[9] xtable_1.8-4 magrittr_2.0.3 cachem_1.1.0 rlang_1.1.4
[13] cli_3.6.3 promises_1.3.0 jquerylib_0.1.4 bslib_0.7.0
[17] tools_4.2.1 htmlwidgets_1.6.4 yaml_2.3.10 httpuv_1.6.15
[21] fastmap_1.2.0 compiler_4.2.1 memoise_2.0.1 htmltools_0.5.8.1
[25] sass_0.4.9
这是reactR 0.6.0中的一个已知错误,会影响可反应性 参见:
https://github.com/react-R/reactR/issues/86 和 https://github.com/glin/reactable/issues/388
使用reactR 0.5.0修复此问题,直到他们修复它。
> install.packages("remotes")
> remotes::install_version("reactR", version = "0.5.0", repos = "http://cran.us.r-project.org")