Shiny app is NOT running when saved in a folder in the computer, BUT will run if unsaved


I just recently got a new laptop and installed the new version of R and RStudio. Now, I could not get my apps to work in the new laptop. They used to work in the old laptop though. Here is the issue and I will use the "Hello App" as an example (this app is not mine and I only copied from the internet) .

If I run the "Hello App" in RStudio WITHOUT saving the file in a folder, it will run with NO problem. Now, if I save the file in a folder in my computer, and then try to run the application, Rstudio will ask "Running Shiny applications requires installation of an updated version of the shiny package. Do you want to install shiny now?" I click YES and it will re-install shiny even I already have it, and then it will NOT run the app after installing shiny. When I click NO, R Studio will not also do anything.

I have already installed shiny, and it's working because when I run the "Hello App" which IS NOT SAVED in a folder, it will run smoothly.

Can somebody please help me solve the problem? I need to run the shiny application which is saved in a folder in my computer.

I am copying paste the "HELLO APP" in the bottom of my email.

Thanks a lot.



ui <- fluidPage(

  titlePanel("Hello Shiny!"),
      sliderInput(inputId = "bins",
                  label = "Number of bins:",
                  min = 1,
                  max = 50,
                  value = 30)
      plotOutput(outputId = "distPlot")

server <- function(input, output) {
  output$distPlot <- renderPlot({
    x    <- faithful$waiting
    bins <- seq(min(x), max(x), length.out = input$bins + 1)
    hist(x, breaks = bins, col = "#75AADB", border = "white",
         xlab = "Waiting time to next eruption (in mins)",
         main = "Histogram of waiting times")

shinyApp(ui, server)