Needing internet to run cargo install

I'm using cargo to build my programs is great when I have internet. But even after downloading all the requirements. I still need internet access to run install.

If I run install with internet. It works, but then if I lose internet access, and run install again. It has to redownload dependencies from crates.io

Why is that?

This is better asked on users.rust-lang.org. you can use the --offline flag to use already built crates

2 Likes

Have you tried using --locked --offline? It's likely redownloading dependencies because without --locked it will re-resolve the dependency tree and come up with different versions (see https://github.com/rust-lang/cargo/issues/7169). Without --offline it will attempt to at least update the index before building.

1 Like

cargo install probably isn't what you want. cargo install is for installing binaries from crates-io. You probably want cargo build.

cargo install path can operate offline, as it installs from the given path. cargo install can't, as it installs from crates-io, which is online.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.