Unexpected String Constant error when updating rmarkdown

I recently started using RStudio after a large gap in time. I updated it (currently at R-4.04) and wanted to open a new rmarkdown file. I was prompted that I needed an updated version of rmarkdown packages, and it appears that 'bslib' 'tinytex' and 'rmarkdown' were set to be installed. However, each package installation returned the following error:

Error: unexpected string constant in:
"suppressPackageStartupMessages(.getRequiredPackages(quietly = TRUE))
tools:::makeLazyLoading("bslib", '"
Execution halted
ERROR: lazy loading failed for package 'bslib'
* removing 'C:/Users/Isaac's PC/Documents/R/win-library/4.0/bslib'
* restoring previous 'C:/Users/Isaac's PC/Documents/R/win-library/4.0/bslib'

At the end of the readout I get the following warning messages:

<U+2714> Package 'rmarkdown' successfully installed.
Warning messages:
1: In utils::install.packages("bslib", repos = "https://cran.rstudio.com/") :
  installation of package 'bslib' had non-zero exit status
2: In utils::install.packages("tinytex", repos = "https://cran.rstudio.com/") :
  installation of package 'tinytex' had non-zero exit status
3: In utils::install.packages("rmarkdown", repos = "https://cran.rstudio.com/",  :
  installation of package 'bslib' had non-zero exit status
4: In utils::install.packages("rmarkdown", repos = "https://cran.rstudio.com/",  :
  installation of package 'tinytex' had non-zero exit status
5: In utils::install.packages("rmarkdown", repos = "https://cran.rstudio.com/",  :
  installation of package 'rmarkdown' had non-zero exit status

Could someone please enlighten me with an explanation or workaround? I am not sure why an automatic installation is having string constant errors. Thanks.

R has known issues with non-ASCII characters in the package library path, I recommend you to set your package library in a different folder.

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

Thank you for the information. However, when I try to run R_LIBS_SITE in the .Renviron file, I get

'R_LIBS_SITE' is not recognized as an internal or external command,
operable program or batch file.

Sorry but I don't understand what you mean by "run". An . Renviron file is not executable, it only defines environment variables.

In my win-library folder I found two .Renviron files, one is a RENVIRON file type and the other is a text document. I tried adding the line to both, but to no avail.

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.