【问题标题】:Error Deploying Apps to shinyapps.io Server将应用程序部署到 shinyapps.io 服务器时出错
【发布时间】:2020-07-04 18:09:22
【问题描述】:

当我刚刚编写了一个可以在本地完美运行的应用程序时,但当我尝试在线部署它时,我不断收到此错误:

错误信息:

准备部署应用程序...完成上传包 应用程序:1969928 ... curl::curl_fetch_memory 中的错误(url,句柄 = 句柄):达到超时:[api.shinyapps.io] 操作计时 10000 毫秒后输出,收到 0 个字节中的 0 个调用: ... tryCatch -> tryCatchList -> tryCatchOne -> 计时停止于:0 0 10

我的闪亮版本:1.4.0.2; 操作系统:Windows10; IDE:RStudio;

如果您能提供帮助,非常感谢!

我的完整代码:

library(shiny)
library(DT)
library(readr)

######################### read data #########################
pump1 <- read_csv("data/1.csv", col_names=TRUE)
pump2 <- read_csv("data/2.csv", col_names=TRUE)
pump3 <- read_csv("data/3.csv", col_names=TRUE)
pump4 <- read_csv("data/4.csv", col_names=TRUE)
pump5 <- read_csv("data/5.csv", col_names=TRUE)
pump6 <- read_csv("data/6.csv", col_names=TRUE)
# pump7 does not have instantFlow feature
pump7 <- read_csv("data/7.csv", col_names=TRUE)

colnames(pump1) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump2) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump3) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump4) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump5) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump6) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "instantFlow", "openDegree", "vacuumDegree")
colnames(pump7) <- c("Date", "backT", "frontT", "moduleT", "I", "V", "openDegree", "vacuumDegree")

######################### ui #########################

ui <- fluidPage(
  h1("Data Presentation", align = "center"),
  br(),
  sidebarLayout(
    sidebarPanel(
      selectInput(inputId = "data", label = "choose data to display", choices = c(
        "pump 1", "pump 2", "pump 3", "pump 4", "pump 5", "pump 6", "pump 7"
      )),
      # contents: Data summary
      h3(textOutput(outputId = "caption")),
      verbatimTextOutput(outputId = "summary"),
      width = 3
    ),
    mainPanel(
      DT::dataTableOutput(outputId = "DToutput", height = 0.5)
    )
  ),
  hr(),
  h1("roc-auc curve", align = "center"),
  br(),
  sidebarLayout(
    sidebarPanel(
      selectInput(inputId = "chooseImg", label = "choose a pump to estimate others",
                  choices = c("pump1 vs all", "pump2 vs all", "pump3 vs all", "pump4 vs all", "pump5 vs all", "pump6 vs all", "pump7 vs all"))
                ),
    mainPanel(
      imageOutput(outputId = "image")
    )
  ),
)
######################### server #########################

server <- function(input, output) {
  ############################# 1st part #############################
  # Now, data is a reactive expression,
  # when the select box changes, data changes to the spefic pump data accordingly
  data <- reactive({
    switch(input$data, 
           "pump 1" = pump1,
           "pump 2" = pump2,
           "pump 3" = pump3, 
           "pump 4" = pump4,
           "pump 5" = pump5, 
           "pump 6" = pump6, 
           "pump 7" = pump7)
    })

  output$caption <- renderText("Data summary")

  output$summary <- renderPrint({
    summary(data())
  })

  output$DToutput <- DT::renderDataTable(data())

  ############################# 2nd part #############################
  # toDisplay <- switch(
  #   input$chooseImg,
  #   "pump1 vs all" = list(src = "images/roc_1vsall.png"),
  #   "pump2 vs all" = list(src = "images/roc_2vsall.png"),
  #   "pump3 vs all" = list(src = "images/roc_3vsall.png"),
  #   "pump4 vs all" = list(src = "images/roc_4vsall.png"),
  #   "pump5 vs all" = list(src = "images/roc_5vsall.png"),
  #   "pump6 vs all" = list(src = "images/roc_6vsall.png"),
  #   "pump7 vs all" = list(src = "images/roc_7vsall.png")
  # )

  output$image <- renderImage({
    if (is.null(input$chooseImg))
      return(NULL)

    if (input$chooseImg == "pump1 vs all")
      return(list(src = "images/roc_1vsall.png"))

    else if (input$chooseImg == "pump2 vs all")
      return(list(src = "images/roc_2vsall.png"))

    else if (input$chooseImg == "pump3 vs all")
      return(list(src = "images/roc_3vsall.png"))

    else if (input$chooseImg == "pump4 vs all")
      return(list(src = "images/roc_4vsall.png"))

    else if (input$chooseImg == "pump5 vs all")
      return(list(src = "images/roc_5vsall.png"))

    else if (input$chooseImg == "pump6 vs all")
      return(list(src = "images/roc_6vsall.png"))

    else if (input$chooseImg == "pump7 vs all")
      return(list(src = "images/roc_7vsall.png"))
  }, deleteFile = FALSE)

}

shinyApp(ui, server)

【问题讨论】:

  • ps:我使用“运行应用程序”旁边的蓝色按钮发布应用程序,在“发布到服务器”页面上,我选择了app.R,数据(文件夹)和图像(文件夹)

标签: r shiny shinyapps


【解决方案1】:

尝试删除 rsconnect 文件夹并从头开始安装 一旦我完成了以下步骤,我的项目就遇到了这个问题:

  • 从项目文件夹中删除 rsconnect 文件夹
  • 使用 RStudio 中的发布按钮重新安装应用程序

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-25
    • 1970-01-01
    • 2014-07-08
    • 2015-06-27
    • 1970-01-01
    • 2014-10-09
    相关资源
    最近更新 更多