R语言 我无法在www.example.com上发布我的Shiny应用程序shinyapps.io

ars1skjm  于 2023-01-15  发布在  其他
关注(0)|答案(1)|浏览(437)

我一直试图在www.example.com上部署一个闪亮的应用程序,但总是得到同样的回应:Shinyapps.io而且没有被使用。日志也没有帮助,所以我不知道还能做什么。请提供任何有用的建议。非常感谢 ERROR: An error has occurred. Check your logs or contact the app author for clarification. . At first, I tried it with my own app, but I give up and I though that my app had an error. Then I get a very simple app from internet that only have a few code lines and... surprise!, It didnt work. I don't know why, because I followed all the steps and I am seeing the app on my local window. So I checked relative paths, etc, and none were used. Logs neither help so I dont know what more to do. Please any advice could be useful. Many thanks
这是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
66bbxpm5

66bbxpm51#

解决了。我在这里发布了我如何做来帮助任何有同样问题的人。首先,我的主要问题是不了解Dockerfile是如何工作的,所以在我看到一些文档后,我没有添加一个需要的包。
这个页面:https://www.linode.com/docs/development/r/how-to-deploy-rshiny-server-on-ubuntu-and-debian/帮了我很大的忙。
此外,我建议使用命令“sudo R”,并首先尝试每个R安装包,以查看每时每刻发生了什么(我在RStudio中制作了应用程序,所以我不知道需要哪些包,如libssl-dev)。这样,您可以轻松地查看所有日志,并能够知道哪些包没有包含在Dockerfile中,而必须包含在其中

相关问题