As you are on window, can you try installing the binaries version to see if this is the source compilation that fails.
install.packages("knitr", type = "binary")
Or change the repository to Public Package Manager for example
install.packages("knitr", repos = "https://packagemanager.rstudio.com/cran/latest")
It seems there were missing binaries in the CRAN mirror you used.