Skip to main content

Issue

When building an environment or installing a package inside a workspace, R raises an error similar to the following:
The package isn’t available from the default Comprehensive R Archive Network (CRAN) mirror (https://cran.us.r-project.org/) configured for this environment. The same package may be available from a different CRAN mirror.

Quick fix: specify a different CRAN mirror inline

Pass a different repo argument directly to install.packages(): install.packages("renv", repo = "https://cran.r-project.org/") This overrides the default mirror for this one installation call without changing any configuration files.

Permanent fix: update the default CRAN mirror

To avoid specifying the repo argument every time, update the default CRAN mirror using one of the options below.

Option 1: edit rsession.conf in your compute environment

Add the r-cran-repos setting to your rsession.conf file and point it to the correct CRAN mirror. For example: r-cran-repos=https://cran.r-project.org/ Locate rsession.conf in your compute environment’s R session configuration directory.

Option 2: edit .Rprofile or Rprofile.site

Set the default CRAN mirror in your .Rprofile or Rprofile.site file. Find both files under your R home directory. Add the following: options(repos = c(CRAN = "https://cran.r-project.org/"))
  • .Rprofile — applies settings for your user session only
  • Rprofile.site — applies settings for all users on the system
After saving either file, restart your R session for the changes to take effect.
Last modified on October 12, 2026