Search code examples
rinstallationpackager-markdownknitr

Attempting to install rmarkdown package gives me the error


Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'xfun' 0.13 is being loaded, but >= 0.15 is required
ERROR: lazy loading failed for package 'knitr'
* removing 'C:/Users/mazen/Documents/R/win-library/3.5/knitr'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘knitr’ had non-zero exit status
ERROR: dependency 'knitr' is not available for package 'rmarkdown'
* removing 'C:/Users/mazen/Documents/R/win-library/3.5/rmarkdown'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘rmarkdown’ had non-zero exit status

Solution

  • You need to install a more recent version of xfun:

    install.packages('xfun')
    

    However, your R version is too old (3.5.x). With this old version of R, you don't have access to CRAN's prebuilt binary version of xfun. Your two choices are:

    1. Either upgrade R;
    2. or install Rtools.

    Unless you are in a locked environment that prevents you from upgrading R, I strongly recommend that you upgrade R, instead of installing Rtools for an old version of R.