error installing knitr

I kept trying to download the package including knitr, but eventually, I couldn't. An error kept popping up.

I uninstalled R and R studio, reinstalled, and restarted them, but failed to resolve the error.

I also tried to install knitr using the Tools > Install Packages method. But an error occurred as shown in the following picture:

What is exdir? What should I do?

R has problems with setting the package library in a cloud-synced folder (OneDrive) and also folders with non-ASCII characters in their path, you are using both. I recommend you to change your default package library to a non-synced folder wich path contains ASCII characters only.

You can change the default library folder by setting your R_LIBS_SITE environmental variable in a .Reviron or .Rprofile file. For example:

# In a .Renviron file you can set it by adding a line like this one with the desired location 
R_LIBS_SITE="C:\\Program Files\\R\\R-4.1.2\\library"

For a more detailed explanation, you can read this blog post

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.