无法在 shinyapps.io 中部署闪亮的应用程序

Posted

技术标签:

【中文标题】无法在 shinyapps.io 中部署闪亮的应用程序【英文标题】:unable to deploy shiny app in shinyapps.io 【发布时间】:2018-02-03 02:11:24 【问题描述】:

我正在尝试部署我在 Rshiny 中制作的应用程序,因为这几天不成功......在本地它工作得很好......当我尝试发布到 Shinyapps.io 帐户时出现唯一问题......

我将包全局加载(在 apps.r 脚本中)为:

加载所需的包

mLoad <- function(...) 
  sapply(sapply(match.call(), as.character)[-1], require, character.only = TRUE)


mLoad(cluster,plyr,dplyr,DT,data.table,ggfortify,ggcorrplot,ggraph,ggplot2,ggthemes,imputeTS,knitr,markdown,purrr,randomForest,rCharts,reshape2,rpivotTable,rsconnect,shiny,shinythemes,shinyapps,tibble,tidyr,tidyverse,vegan,VIM,visdat)

我在部署时遇到以下错误.....

An error has occurred

The application failed to start.

Loading required package: cluster
Loading required package: plyr
Loading required package: dplyr

Attaching package: ‘dplyr’

The following objects are masked from ‘package:plyr’:

    arrange, count, desc, failwith, id, mutate, rename, summarise,
    summarize

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

Loading required package: DT

Attaching package: ‘DT’

The following objects are masked from ‘package:shiny’:

    dataTableOutput, renderDataTable

Loading required package: data.table
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘data.table’
Loading required package: ggfortify
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘ggfortify’
Loading required package: ggcorrplot
Loading required package: ggplot2
Loading required package: ggraph
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘ggraph’
Loading required package: ggthemes
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘ggthemes’
Loading required package: imputeTS
Loading required package: knitr
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘knitr’
Loading required package: markdown
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘markdown’
Loading required package: purrr
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘purrr’
Loading required package: randomForest
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘randomForest’
Loading required package: rCharts
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘rCharts’
Loading required package: reshape2
Loading required package: rpivotTable
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘rpivotTable’
Loading required package: rsconnect
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘rsconnect’
Loading required package: shinythemes
Loading required package: shinyapps
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘shinyapps’
Loading required package: tibble
Loading required package: tidyr
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘tidyr’
Loading required package: tidyverse
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘tidyverse’
Loading required package: vegan
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘vegan’
Loading required package: VIM
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘VIM’
Loading required package: visdat
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘visdat’
Error in value[[3L]](cond) : could not find function "rpivotTableOutput"
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted..

据我所知,所有必需的软件包都已从 CRAN 或 Github 本地安装......仍然不知道为什么我收到上述错误......

某些包之间似乎存在冲突....无法弄清楚在哪里....

【问题讨论】:

【参考方案1】:

解决了 Shiny 部署问题......只需将库名称放在 rpivotTableOutput("mypivot") 的 ui 部分中,如下所示......

rpivotTable::rpivotTableOutput("mypivot")..

事实上,即使在部署后,许多功能也无法正常工作(本地应用程序可以无缝运行)....对于 dplyr 的 ex...rename(),即使在加载 dplyr 库之后......只需将函数前面的库名称....dplyr::rename().....必须为应用程序中的许多功能做......在server以及闪亮代码的ui部分......

请在这里查看我的闪亮应用:

https://nishantsbi.shinyapps.io/microsegmentation_ml_app/

【讨论】:

以上是关于无法在 shinyapps.io 中部署闪亮的应用程序的主要内容,如果未能解决你的问题,请参考以下文章

无法将应用程序部署到 shinyapps.io:无法确定包源

部署闪亮的应用程序时出错

在 Rstudio 之外运行闪亮的应用程序

检索托管在 shinyapps.io 中的应用程序的原始代码

在 DigitalOcean ubuntu 服务器上托管闪亮的应用程序时出错

Shinyapps 上的 Markdown 文档:应用程序无法启动