nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

cargo install-update report `error: no index found for registry` #185

Open viruscamp opened 2 years ago

viruscamp commented 2 years ago

cargo install-update report error: no index found for registry
but cargo install success.

>cargo install-update bat
    Updating registry 'https://rsproxy.cn/crates.io-index'

Package  Installed  Latest   Needs update
bat      v0.18.3    v0.21.0  Yes

Updating bat
error: no index found for registry: `rsproxy`

Updated 0 packages.
Failed to update bat.
>cargo install bat

Replaced package `bat v0.18.3` with `bat v0.21.0` (executable `bat.exe`)

That is my cargo\config

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"

replace-with = 'rsproxy'

[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
nabijaczleweli commented 2 years ago

This error comes from cargo directly. Can you mv ~/.cargo/registry/rsproxy.cn-* ~/.cargo/registry/rsproxy.cn.old and, run cargo install zupsko (should fail) then cargo install-update bat again?

idlercloud commented 2 years ago

This error comes from cargo directly. Can you mv ~/.cargo/registry/rsproxy.cn-* ~/.cargo/registry/rsproxy.cn.old and, run cargo install zupsko (should fail) then cargo install-update bat again?

Did you mean ~/.cargo/registry/index/rsproxy.cn-*? I do so and it doesn't work with the same report.

In fact, following the troubleshooting https://github.com/nabijaczleweli/cargo-update#source-replacement-vs-custom-registries may resolve this, at least it works for me :)

Try to add

[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"

to your config.toml.

viruscamp commented 10 months ago

I think I found the cause: in %CARGO_HOME%\.crates.toml

[v1]
"cargo-expand 1.0.74 (registry+https://rsproxy.cn/crates.io-index)" = ["cargo-expand.exe"]
"irust 1.71.14 (registry+https://github.com/rust-lang/crates.io-index)" = ["irust.exe"]

When I ran cargo install-update --all, cargo-expand had been updated, but it got a failure on irust.

It should be: cargo install irust without change %CARGO_HOME%\config.toml
edit %CARGO_HOME%\config.toml to use rsproxy
cargo install cargo-expand
cargo install-update --all , it use the info in %CARGO_HOME%\.crates.toml, but it won't update https://github.com/rust-lang/crates.io-index