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

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay