An error has occurred... pngfun X11



I'm trying to publish a sample Shiny app from RStudio Server to a new RStudio Connect server. The app works fine in the IDE but when launching it on Connect the UI controls are visible and functional but the plot does not, and the following error appears.

An error has occurred. Check your logs or contact the app author for clarification.

The log shows:

2018/06/21 15:01:55.394809822 Warning: Error in pngfun: X11 is not available
2018/06/21 15:01:55.400168006   135: pngfun
2018/06/21 15:01:55.400170441   134: startPNG
2018/06/21 15:01:55.400186292   133: drawPlot
2018/06/21 15:01:55.400187705   119: <reactive:plotObj>
2018/06/21 15:01:55.400206628   103: drawReactive
2018/06/21 15:01:55.400208048    90: origRenderFunc
2018/06/21 15:01:55.400217859    89: output$distPlot
2018/06/21 15:01:55.400219078    13: runApp
2018/06/21 15:01:55.400228817    12: fn
2018/06/21 15:01:55.400230047     7: connect$retry
2018/06/21 15:01:55.400239665     6: eval
2018/06/21 15:01:55.400240940     5: eval

Any ideas or anywhere else I should look for more information?


I found that the R option for bitmapType on the RStudio Server was set to "cairo" but on the RStudio Connect server it was set to "xlib" even though R was configured without X11 support.

R was installed via yum on the RStudio Server and from source on the RStudio Connect server.

Is there a better way to do this? And change the option server-wide?


We recommend that you install R from source, both for RStudio Connect and RStudio Server Pro. This is the only way to be sure your code will run on the version of R you intended, rather than the system R (provided by yum).

Since you have already built R from source on this machine, it may be as simple as changing the RStudio Server config file to point to the location where you installed R (from source).

See the admin guide Section 6 R versions for instructions. Specifically, you can define the installed versions in the file /etc/rstudio/r-versions, as described in Section 6.4.1. For example: