error: no index found for registry: `local-registry`
Alternatively, if registry.default is set to local-registry in .cargo/config.toml, the same error occurs without passing --registry local-registry.
Possible Solution(s)
cargo add --registry foo bar should (assuming that bar exists in the registry foo) add
bar = { version = "...", registry = "foo" }
to Cargo.toml.
Ideally, I think if there's a source replacement of crates-io to foo, cargo add should be smart enough to realize the registry = "foo" part should not be necessary.
Problem
cargo add
is unable to add crates when told to use a registry that is a local or directory registry.Steps
cargo new --lib foo && cd foo
cargo add libc
cargo check
mkdir .cargo
cargo local-registry -s Cargo.lock local-registry > .cargo/config.toml
sed '/itoa/d' Cargo.toml
cargo add --registry local-registry itoa
Produces
Alternatively, if
registry.default
is set tolocal-registry
in.cargo/config.toml
, the same error occurs without passing--registry local-registry
.Possible Solution(s)
cargo add --registry foo bar
should (assuming thatbar
exists in the registryfoo
) addto
Cargo.toml
.Ideally, I think if there's a source replacement of
crates-io
tofoo
,cargo add
should be smart enough to realize theregistry = "foo"
part should not be necessary.Notes
No response
Version