Shiny Apps not loading on R Version 4.1.0

I am falling at the first hurdle when attempting to create a dashboard with shiny.
As the most basic example...if I got to new --> shiny web app... and try to run the template code that appears (copied below), it doesn't work. I get 'Loading required package: shiny' in the console but I believe it should also say 'listening on [url]' which it doesn't.

All in all, nothing happens! Except that something is running and the only way I can get out of it is quit R.

I posted my session/version info at the very bottom.

Any help would be really appreciated!

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)


This is my session/version info:
Show in New Window
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_4.1.0 htmltools_0.5.1.1 tools_4.1.0 yaml_2.2.1 rmarkdown_2.8 knitr_1.33 xfun_0.23
[8] digest_0.6.27 rlang_0.4.11 evaluate_0.14
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 1.0
year 2021
month 05
day 18
svn rev 80317
language R
version.string R version 4.1.0 (2021-05-18)
nickname Camp Pontanezen

FWIW, I copied your code, saved it as app.R, commented out the non-code lines, and it worked correctly for me.

When looking at my session info output, I have shiny_1.6.0 listed under "other attached packages:" which I don't see in your output.

Hey,

Thanks for responding. I have shiny v 1.6.0 as well.

I tried running even the most basic shiny example in the console:

library(shiny)
runExample("01_hello")

this works for my peers, but not for me!!

They get the dashboard popping up and I get....nothing...

I'm definitely outside my comfort/knowledge zone here, but it seems others (maybe) have reported similar issues with 4.1 and so I wonder if you might try to test this in 4.05 and see if the issue persists?

Thank you!!!! So so much! I downloaded version 4.0.5 (I had 4.1.0 before) and by reverting to the older version, it worked perfectly.
So it looks like shiny apps don't launch in RStudio with R version 4.1.0. I'm on windows, maybe it works on other OS?!
Anyway, thanks so much, really appreciate your help.

Generally, is there a way to let the people who make Shiny know about this? I'm thinking it would be helpful to highlight it and save others the stress.

1 Like

Glad to hear! And yes, a little worrisome. I'm running 4.05 so won't update.

Maybe you could change the title of your post to "Shiny not running on R4.1.0" or similar and hope someone sees it?

1 Like

Yes I will do this :slight_smile: good idea

Works for me on latest versions

I'm having this exact same issue. I can't run shiny apps using R version 4.1.0 from RStudio version 1.4.1717, but my apps run fine if I revert to R version 4.0.5.

I had the exact same problem and found the solution. I tried Shiny for the first time and was not able to run an app localy. To provide context I had the 4.0.3 version of Rstudio and upgraded to 4.1.0 (sometime in the past year). I tried to run the " old geyser " Shiny app example and console was stuck on a runApp message or " Loading required package: shiny"

I found another thread that suggested to revert back to Rstudio 4.0.5 (and so I did), but I was having the same problem.

Finally, solution came from Winston Chan and was link to a mismatch in the libraries built and Rstudio built. Take the time to read the post and it will show you how to upgrade all your librairies to your Rstudio built version

https://shiny.rstudio.com/articles/upgrade-R.html

Just for some additional information on this. I was unable to run the shiny example apps in RStudio console with R 4.1.0. However, when I opened R GUI, I was able to run them just fine. There's definitely something going on with RStudio here.

Update: I re-installed RStudio and now I can run the example apps within RStudio just fine.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.