闪亮的应用程序无法启动

时间:2017-07-19 20:12:05

标签: r shiny shiny-server

我写了一个Hello World闪亮的应用程序如下:

/local/sampleShinyApp/ui.R:

library(shiny)
ui <- shinyUI(fluidPage(h1('Hello World')))

/local/sampleShinyApp/server.R:

library(shiny)
shinyServer(function(input, output){})

在命令行上直接运行R,并在R控制台中运行以下命令时,应用程序正常运行。当我转到http://my_hostname:3838时,我看到了一个Hello World页面。

shiny::runApp('/local/sampleShinyApp/', host='172.XX.XXX.XXX(my host ip)', port=3838)

但是,当我使用完全相同的应用程序设置闪亮的服务器专业版时,我在页面上出现错误。有人可以帮我调试吗?

网页上的错误消息:

An error has occurred
The application failed to start.
The application exited during initialization.

日志文件(sampleShinyApp-shizhe-20170719-185527-37309.log):

Error: unexpected '/' in "/"
Error: unexpected symbol in "28abbec4a109de74238ef34e00c83359"
Error: unexpected numeric constant in "1.5.3"
Error: unexpected symbol in "3468d94033c5b8761545f25784af09680d2ed8577323298b"
Error: object 'shiny' not found
Error: unexpected '/' in "/"
Error: object 'true' not found
Error: object 'true' not found
Error: unexpected '/' in "/"

/etc/shiny-server/shiny-server.conf:

run_as shizhe shiny;
server {
  listen 3838;                                                                                        
  location / {                                                                                                          
    utilization_scheduler 20 .9 3;                                                                            
    app_dir /local/sampleShinyApp;                                                                         
    log_dir /var/log/shiny-server;                                                                                                     
    run_as shizhe shiny;                                                                               
  }
}

启动shiny-server:

sudo stop shiny-server; sudo start shiny-server

1 个答案:

答案 0 :(得分:0)

你没有在闪亮的应用程序中绑定ui和服务器。请尝试运行以下代码:

library(shiny)

# Define UI for application 
ui <- fluidPage(
  h1("hello world")
)
 # Define server logic required to draw a histogram
server <- function(input, output) {
}
# Run the application 
shinyApp(ui = ui, server = server)