Graphics API version mismatch while saving a plot as pdf

Hello everyone;
After updating my R version I faced the Graphics API version mismatch error while creating plots. after updating packages RAGG and Cairo this error disappeared. but when I tried to save a plot as pdf or knitr my markdown this error appeared, again.
Does anyone know any solution to this?