rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.75k stars 2.42k forks source link

skip registry update #11608

Closed jackzhp closed 1 year ago

jackzhp commented 1 year ago

Problem

I am on a slow connection, I had successfully build the project. then a few days later. when I want to rebuild it, I got:

error: failed to get base64 as a dependency of package grin_wallet_api v5.2.0-alpha.1 (/data3/soft/mimblewimble/2022/grin-wallet/api) Caused by: failed to load source for dependency base64 Caused by: Unable to update registry crates-io Caused by: failed to fetch https://github.com/rust-lang/crates.io-index

In fact, under ~/.cargo/....., I have many copies of base64 already: base64-0.11.0.crate base64-0.13.0.crate base64-0.12.3.crate base64-0.9.3.crate

and I am using 0.12.3, why do I have to download base64 again?

Proposed Solution

I hope when I rebuild the project, we don't have to download anything.

Notes

No response

ehuss commented 1 year ago

It's hard to say why it specifically needs it. Usually that happens when Cargo.toml is modified, such as adding a new dependency, or changing a version requirement. Another possibility is running cargo update.

It may not need to download base64 specifically. The error comes from updating the index so that Cargo can determine which versions are available.

There are a few options for you:

weihanglo commented 1 year ago

ehuss has provides a couple of options to deal with slow or offline use of Cargo. I am going to close this as this seems to be a usage question. If it turns out a bug in Cargo, please create a minimal, complete, and verifiable example]mcve, and we can look into it. Thank you!