Can get Shiny to work

I have downloaded and installed R 4.1.0 and Rstudio 1.4.1717 for Windows 10 64 bit.
Tidyverse, ggplot all working but not shiny, not even the shiny demo

library(shiny)
runExample("01_hello")

See attached image

I have tried reinstalling everything, run as admin. Can anyone help me.
Much obliged for your help

Hi,

Welcome to the RStudio community!

Can you tell my what about the demo is not working? By default, the demo is run in the Viewer pane, so what do you see there when you run the demo?

PJ

thank you for replying.
As shown in the screenshot, RStudio freezes. I thought it should show "listening on port" and the opens up a new window with "hello world"
I tried many examples with shiny, and they always seem to go into an infinite loop processing something

Hi,

Does the same happen when you run the default app when creating a new shiny app (File -> New -> Shiny App)? Try also so use the external browser and see if it makes a difference.

PJ

you mean not using the RStudio own browser, but use Firefox instead? How do do that?

yes it does. I tried the example from Mastering Shiny

library(shiny)
ui <- fluidPage(
  "Hello, world!"
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
``

This hangs with the message "Loading required package: shiny"

What do you mean by using an external browser?
https://127.0.0.1 gives an error

image

Click the little dropdown next to the Run App icon and choose Run External

PJ

doesn't help. Same message "Loading required package: shiny".
Tried installing shiny in users directory and in c:\program files, same results.
Maybe some of its components are missing?

Hi,

I'm all out of ideas now sorry. Hopefully someone else on here might have a clue...

PJ

do I need to install the Rstudio server for shiny to work?

No, Shiny should just be able to run with the correct package installed in RStudio desktop.

I am also getting a similar issue, I installed R and R Studio on a new windows machine

Hi all,

According to a seemingly related post on stackoverflow, the issue might be linked to the latest R version in some cases. You could try to downgrade to R 4.0.5 and see if this helps.

If you have multiple R versions installed, you can switch the default R version in the general settings in RStudio.

PJ

OK, thanks for the information. Will try it

I was having the same issue with R vresion 4.1.0, but my app runs with no issues on R version 4.0.5.

1 Like

In R 4.1, what do you get when you run .libPaths()? If it points to the same directory (or directories) as R 4.0, then that means that packages will be shared between the two R versions, which would almost certainly cause problems. Note that it's probably not the Shiny package itself which would have problems; instead it would likely be a package with compiled code, such as {httpuv} or {later}.

For more information about safely upgrading R versions, please see:
https://shiny.rstudio.com/articles/upgrade-R.html

4 Likes

thank you so much. I haven't had time to install R 4.0, I still have R 4.1 where I had the original problem.
I ran

update.packages(ask = FALSE, checkBuilt = TRUE)
and the message was
There are binary versions available but the source versions are later:
          binary source needs_compilation
reprex     2.0.0  2.0.1             FALSE
rsconnect 0.8.18 0.8.24             FALSE
tinytex     0.32   0.33             FALSE
vroom      1.5.3  1.5.4              TRUE

after the update, it works ! Thank you

1 Like

This topic was automatically closed 7 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.