'Warning: Error in <Anonymous>: cannot open file 'Rplots.pdf'

After I deploy my R shiny App in web server, it produced such errors. Can anyone help me to solve it? Thanks.

This error is very weird. I can run it in Shiny web server (http://www.shinyapps.io/). But I can not run it on my own web server. I commented out the code which produce pdf. But the error is still existing.

su: ignore --preserve-environment, it's mutually exclusive to --login.

Listening on http://127.0.0.1:37436 Warning: Error in : cannot open file 'Rplots.pdf' 48:

Execution halted



Solution 1:[1]

This is probably because your code has a function that generates a plot, and the server is, by default, trying to save it to a pdf file because it's a non-interactive session (that is, it does not display it on the screen).

The fix is to find that statement and remove it.

Solution 2:[2]

When generating plots on Shiny server, it automatically tries to create a PDF file. You can remove this functionality by having the below in your code, before the plotting function.

pdf(file = NULL)

Solution 3:[3]

The following code solves my problem:

chown -R shiny:shiny /srv/shiny-server

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gimelist
Solution 2 Phanis Ioannou
Solution 3 showteth