Shiny Run App Help

Hello
In need of some help. I was about to start on my first Shiny App since a few months ago and I am now getting a strange issue that I have never encountered before. When going to File -> New Project -> New Directory -> Shiny Web Application, supplying a Directory name and clicking create project I get an unable to open file error. After clicking OK on the error message window and then in the files pane clicking and opening app.R and clicking Run App, the command executed is shiny::runApp('') which returns an error Error in shinyAppDir(x) : No Shiny application exists at the path "". If I type just runApp() in the console then the demo application runs without issue. It seems that there is an issue when Rstudio is trying to reference the directory path. I checked the working directory and it is set to the newly created project.

I am running R version 3.5.2 and Rstudio version 1.2.1335 on Windows 10. I am pretty sure this is the first Shiny App I have tried creating since upgrading Rstudio from 1.1.463.

I tried searching on the topic but didnt come across anything. Any ideas on the issue? Any help would be greatly appreciated.

Thanks!
Matt

Did you try to create the project in a valid location? Make sure there are no spaces in the path name, this sometimes causes problems. It might not work over a network or virtual drive too.

Did RStudio create the project? You should get the new folder containing the foldername.Rproj file and app.R. app.R contains the following code. It should run if you click Run App and you will get a slider and a histogram.

#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
#    http://shiny.rstudio.com/
#

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(

    # Application title
    titlePanel("Old Faithful Geyser Data"),

    # Sidebar with a slider input for number of bins 
    sidebarLayout(
        sidebarPanel(
            sliderInput("bins",
                        "Number of bins:",
                        min = 1,
                        max = 50,
                        value = 30)
        ),

        # Show a plot of the generated distribution
        mainPanel(
           plotOutput("distPlot")
        )
    )
)

# Define server logic required to draw a histogram
server <- function(input, output) {

    output$distPlot <- renderPlot({
        # generate bins based on input$bins from ui.R
        x    <- faithful[, 2]
        bins <- seq(min(x), max(x), length.out = input$bins + 1)

        # draw the histogram with the specified number of bins
        hist(x, breaks = bins, col = 'darkgray', border = 'white')
    })
}

# Run the application 
shinyApp(ui = ui, server = server)

Hey Woodward
Thanks for the response. Yes Rstudio created the project and the associated directory.

I rolled Rstudio back to version 1.1.463 and now clicking the Run App button works and runs the app without issue. What I noticed however is that when clicking the Run App button in the older version, the command executed in the console is shiny::runApp('//xx/home/xx/Desktop/R Projects/shiny_test'). When I clicked Run App for this same project in the same folder in the latest Rstudio version the command executed in the console was just shiny::runApp(''). Any idea why the newest version isn't inserting the path into the command when using Run App? Using getwd() in both Rstudio versions shows the project path is the same.

Matt

I just encountered this after updating, and I have a feeling it is because of this error, with UNC formatted directories, i.e. "\\\\T/Directory/foo/bar". I'm running a project from a network location, and with getwd() I see my working directory is in that UNC format. Running that exact address with shiny::runApp() worked, as well as with no address, but shiny::runApp('') does not. Same thing with runApp(). Odd.

Running on 1.2.1572, R 3.6.1, Win10 x64.

1 Like

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.