Pkg cannot find registered packages

From one minute to another, my installation of Julia cannot add packages anymore. I tried reinstalling Julia but to no avail. How can I fix this?

(@v1.5) pkg> add DiffResults
  Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DiffResults [163ba53b]:
 DiffResults [163ba53b] log:
 ├─DiffResults [163ba53b] has no known versions!
 └─restricted to versions * by an explicit requirement — no versions left

(@v1.5) pkg> add LinearAlgebra
  Resolving package versions...
ERROR: Unsatisfiable requirements detected for package CSV [336ed68f]:
 CSV [336ed68f] log:
 ├─CSV [336ed68f] has no known versions!
 └─restricted to versions * by an explicit requirement — no versions left

(@v1.5) pkg> add CSV
  Resolving package versions...
ERROR: Unsatisfiable requirements detected for package CSV [336ed68f]:
 CSV [336ed68f] log:
 ├─CSV [336ed68f] has no known versions!
 └─restricted to versions 0.8.2 by an explicit requirement — no versions left

You (probably) have a broken or non-existing registry. Try to remove and add again:

# Remove
rm(joinpath(DEPOT_PATH[1], "registries", "General"); force=true, recursive=true)
# Add
import Pkg
Pkg.Registry.add("General")
4 Likes

That worked, thank you so much!