Skip to content

Installing an Older Package Version from Archive

As mentioned in the repository dependency configuration note, rv intentially does not have a way to specify a version directly. Instead, you can install a package using the url configuration to install a package from the archive or add an older snapshot and specify an out of order repositories, as seen in the older snapshot example.

In this example we would like to install jsonlite 1.9.1 and cli, but jsonlite 2.0.0 is the version available in the repository.

In the config file, we add the dependency using the url configuration to point to the Archive. In a CRAN-like repository, packages are found in the archive in the pattern {repo url}/src/contrib/Archive/{pkg name}/{pkg name}_{pkg version}.tar.gz

rproject.toml
[project]
name = "archive"
r_version = "4.4"
repositories = [
# This repository can be any CRAN mirror. For this example, setting a stable snapshot for reproducible versions.
{ alias = "PPM", url = "https://packagemanager.posit.co/cran/2025-05-01" },
]
dependencies = [
"cli",
# "jsonlite", # would install `jsonlite 2.0.0`
{ name = "jsonlite", url = "https://cran.r-project.org/src/contrib/Archive/jsonlite/jsonlite_1.9.1.tar.gz" },
]

Below is the result of syncing the project. Notice, all other packages (including potential dependencies of the archived package) are sourced from the specified repository.

Terminal window
$ rv sync
+ cli (3.6.5, binary from https://packagemanager.posit.co/cran/2025-05-01) in 595ms
+ jsonlite (1.9.1, source from https://cran.r-project.org/src/contrib/Archive/jsonlite/jsonlite_1.9.1.tar.gz) in 2549ms