Error in dev.control(displaylist = "enable")

when trying to plot a histogram on Rstudio, I got this error:
Error in dev.control(displaylist = "enable") : dev.control() called without an open graphics device

Trackback shows:
6. stop("dev.control() called without an open graphics device")
5. dev.control(displaylist = "enable")
4. (function () { .rs.createNotebookGraphicsDevice(filename, height, width, units, pixelRatio, extraArgs) ...
3. grid.newpage()
2. print.ggplot(x)

  1. function (x, ...) UseMethod("print")(x)

however I can plot the same thing inside R (terminal).

Have any idea hat is wrong?