简体   繁体   中英

shiny server cannot open the connection when trying to include RMarkDown

I was trying to insert some rmd files into my shiny dashboard. Everything works fine locally. But when I tried it on my shiny server, it shows:

Warning in file(file, ifelse(append, "a", "w")) : cannot open file 'testing.md': Permission denied Warning: Error in file: cannot open the connection

it's just a very simple testing shiny dashboard:

app.R

library(shiny)
library(knitr)
library(shinydashboard)

setwd("/srv/shiny-server/docs/test2")

rmdfiles = c("testing.Rmd")
sapply(rmdfiles, knit, quiet = T)

ui <- dashboardPage(
  dashboardHeader(title = "testing"),
  dashboardSidebar(
    sidebarMenu(
      menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
      menuItem("Widgets", tabName = "widgets", icon = icon("th"))
    )
  ),
  dashboardBody(
    tabItems(
      tabItem(
        tabName = "dashboard",
        uiOutput("testing")
      ),

      tabItem(
        tabName = "widgets",
        234
      )
    )
  )
)

server <- function(input, output) {
  output$testing <- renderUI({
    includeMarkdown("testing.md")
  })
}

shinyApp(ui, server)

and testing.rmd is just the sample rmd.

Anybody have some ideas? Thanks!

Are you sure this works locally? From a quick glance through what you've posted, I would start by changing the server portion to includeMarkdown("testing.Rmd") , the file listed in your current code is ".md" and that's also the file extension showing up in the Warning you're seeing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM