0

我一直在尝试在 Shinyapps.io 上部署一个闪亮的应用程序,但我总是得到相同的响应:ERROR: An error has occurred. Check your logs or contact the app author for clarification.. 起初,我用自己的应用程序尝试过,但我放弃了,我认为我的应用程序有错误。然后我从互联网上得到了一个非常简单的应用程序,它只有几行代码,而且......惊喜!,它没有用。我不知道为什么,因为我按照所有步骤操作,并且在本地窗口中看到了该应用程序。所以我检查了相对路径等,没有使用。日志既无帮助,所以我不知道还能做什么。请任何建议都可能有用。非常感谢

这是 R 闪亮的代码:

用户界面

library(shinydashboard)
library(rsconnect)


setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
deployApp()
ui <- dashboardPage(
  dashboardHeader(title = "Info boxes"),
  dashboardSidebar(),
  dashboardBody(
    # infoBoxes with fill=FALSE
    fluidRow(
      # A static infoBox
      infoBox("New Orders", 10 * 2, icon = icon("credit-card")),
      # Dynamic infoBoxes
      infoBoxOutput("progressBox"),
      infoBoxOutput("approvalBox")
    ),

    # infoBoxes with fill=TRUE
    fluidRow(
      infoBox("New Orders", 10 * 2, icon = icon("credit-card"), fill = TRUE),
      infoBoxOutput("progressBox2"),
      infoBoxOutput("approvalBox2")
    ),

    fluidRow(
      # Clicking this will increment the progress amount
      box(width = 4, actionButton("count", "Increment progress"))
    )
  )
)

服务器.R

server <- function(input, output) {
  output$progressBox <- renderInfoBox({
    infoBox(
      "Progress", paste0(25 + input$count, "%"), icon = icon("list"),
      color = "purple"
    )
  })
  output$approvalBox <- renderInfoBox({
    infoBox(
      "Approval", "80%", icon = icon("thumbs-up", lib = "glyphicon"),
      color = "yellow"
    )
  })

  # Same as above, but with fill=TRUE
  output$progressBox2 <- renderInfoBox({
    infoBox(
      "Progress", paste0(25 + input$count, "%"), icon = icon("list"),
      color = "purple", fill = TRUE
    )
  })
  output$approvalBox2 <- renderInfoBox({
    infoBox(
      "Approval", "80%", icon = icon("thumbs-up", lib = "glyphicon"),
      color = "yellow", fill = TRUE
    )
  })
}

日志:

    2018-04-26T16:47:00.598156+00:00 shinyapps[331049]: 
2018-04-26T16:47:00.608370+00:00 shinyapps[331049]: The following object is masked from ‘package:shiny’:
2018-04-26T16:47:00.608017+00:00 shinyapps[331049]: 
2018-04-26T16:47:00.608371+00:00 shinyapps[331049]: 
2018-04-26T16:47:00.608019+00:00 shinyapps[331049]: Attaching package: ‘rsconnect’
2018-04-26T16:47:00.608371+00:00 shinyapps[331049]:     serverInfo
2018-04-26T16:47:00.598159+00:00 shinyapps[331049]: Attaching package: ‘shinydashboard’
2018-04-26T16:47:00.608372+00:00 shinyapps[331049]: 
2018-04-26T16:47:00.598161+00:00 shinyapps[331049]: 
2018-04-26T16:47:00.612987+00:00 shinyapps[331049]: Warning: Error in : RStudio not running
2018-04-26T16:47:00.617053+00:00 shinyapps[331049]:     12: fn
2018-04-26T16:47:00.598930+00:00 shinyapps[331049]: The following object is masked from ‘package:graphics’:
2018-04-26T16:47:00.617046+00:00 shinyapps[331049]: Stack trace (innermost first):
2018-04-26T16:47:00.617054+00:00 shinyapps[331049]:     11: doTryCatch
2018-04-26T16:47:00.598932+00:00 shinyapps[331049]: 
2018-04-26T16:47:00.617048+00:00 shinyapps[331049]:     58: verifyAvailable
2018-04-26T16:47:00.617054+00:00 shinyapps[331049]:     10: tryCatchOne
2018-04-26T16:47:00.598933+00:00 shinyapps[331049]:     box
2018-04-26T16:47:00.617048+00:00 shinyapps[331049]:     57: callFun
2018-04-26T16:47:00.617054+00:00 shinyapps[331049]:      9: tryCatchList
2018-04-26T16:47:00.617051+00:00 shinyapps[331049]:     55: rstudioapi::getActiveDocumentContext
2018-04-26T16:47:00.617055+00:00 shinyapps[331049]:      7: connect$retry
2018-04-26T16:47:00.617052+00:00 shinyapps[331049]:     54: dirname
2018-04-26T16:47:00.617056+00:00 shinyapps[331049]:      6: eval
2018-04-26T16:47:00.617052+00:00 shinyapps[331049]:     53: setwd
2018-04-26T16:47:00.617053+00:00 shinyapps[331049]:     13: runApp
2018-04-26T16:47:00.598934+00:00 shinyapps[331049]: 
2018-04-26T16:47:00.617049+00:00 shinyapps[331049]:     56: getDocumentContext
2018-04-26T16:47:00.617055+00:00 shinyapps[331049]:      8: tryCatch
2018-04-26T16:47:00.608019+00:00 shinyapps[331049]: 
2018-04-26T16:47:00.617057+00:00 shinyapps[331049]:      4: eval
2018-04-26T16:47:00.617057+00:00 shinyapps[331049]:      3: eval
2018-04-26T16:47:00.617057+00:00 shinyapps[331049]:      2: eval.parent
2018-04-26T16:47:00.617058+00:00 shinyapps[331049]:      1: local
2018-04-26T16:47:00.617405+00:00 shinyapps[331049]: Error : An error has occurred. Check your logs or contact the app author for clarification.
2018-04-26T16:47:00.617056+00:00 shinyapps[331049]:      5: eval
4

1 回答 1

0

解决了。我在这里发布如何帮助有同样问题的任何人。首先,我的主要问题是不太了解 Dockerfile 是如何工作的,所以在一些文档之后我看到我没有添加 Shiny Server 所需的包。

这个页面:https ://www.linode.com/docs/development/r/how-to-deploy-rshiny-server-on-ubuntu-and-debian/帮了我很多。

另外,我建议使用命令“sudo R”并首先尝试每个 R 安装包以查看每时每刻发生的情况(我在 RStudio 中制作了应用程序,所以我不知道需要哪些包 - 如 libssl-dev) . 通过这种方式,您可以轻松查看所有日志,并且能够知道您没有包含哪些包并且必须在 Dockerfile 中

于 2018-05-07T11:12:54.427 回答