How to draw a plot in shiny with vscode?

When I run a shinyApp, it cannot draw any plot when I am using vscode. like this:
图片
this is my app

app <- shinyApp(

    ui = fluidPage(

      numericInput("n", "n", 1),

      plotOutput("plot")

    ),

    server = function(input, output) {

      output$plot <- renderPlot( plot(head(cars, input$n)) )

    }

  )

  runApp(app)

I got it, the r version is too new, must the 4.1.3, I'm the 4.2.0