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



    server = function(input, output) {

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




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