DEV Community

pahlavaubivca
pahlavaubivca

Posted on

Rust registry error "candidate versions found which didn't match"

Env

  • OS: WSL2 (Windows11)
  • IDE: RustRover
  • cargo version: 1.83.0

Description

Rare but pretty annoying error like:

error: failed to select a version for the requirement `winit = "^0.30.5"`
candidate versions found which didn't match: 0.9.0, 0.8.3, 0.8.2, ...
location searched: crates.io index
required by package `eframe v0.29.1`
    ... which satisfies dependency `eframe = "^0.29.1"` of package `my_proj v0.1.0 (/home/user/my_proj)`
Enter fullscreen mode Exit fullscreen mode

Appears despite package winit = "^0.30.5 exist on crates.io

I faced this error when tried update Cargo.toml during debug my project, but possible can happen in other situation.

Solution 1

Remove registry folder and rerun cargo build or cargo update

rm -R ~/.cargo/registry

Caution: after remove - cargo will fetch full list of packages from Cargo.toml and for all projects - so its can take some time. Also not sure about any problem if you have custom packages installed on machine.

Solution 2

Not tested by me

Install cargo-cache (https://crates.io/crates/cargo-cache) and use manual.

Source

Top comments (0)