Rstudio desktop has a bug when loading default shiny app

I'm using:
R version 4.1.2
Rstudio version 2021.09.01
Windows 10
shiny 1.7.1
tidyverse 1.3.1

After starting Rstudio and trying to run a project with the default shiny app with a call to tidyverse library added, I can get one of several errors like:

Error in match.fun(FUN) : object 'FUN' not found

*** recursive gc invocation

Error in rlang_as_list(x) : could not find function "rlang_as_list"
Error: unable to load R code in package ‘htmltools’

R session aborted

Loading required package: shiny
Warning: stack imbalance in 'Recall', 56 then 58
*** recursive gc invocation
Error: package or namespace load failed for ‘tidyverse’ in if (is.character(f) && f %in% "as.double") f <- "as.numeric":
missing value where TRUE/FALSE needed

Error in get(which, envir = ns[[".NAMESPACE."]]) :
invalid first argument

Sometimes it'll work but most of the time i get an error. I'm pretty sure it has to do with rstudio because if I run the shiny app from r console the app works perfectly every time.

The default shiny app code is as follows:

library(shiny)
library(tidyverse)

# 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)

Please help.

I'm getting a similar problem as well. Tried the solution here, but it didn't help:

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