如何在没有互联网的环境中安装生锈依赖性?
我想使用 Tango Client crate crate 在一个Rust Project有效,但是我将要开发的环境没有直接访问互联网。这意味着将依赖关系添加到cargo.toml
和运行货物构建
由于网络错误而失败的标准方法。
环境并不能阻止我将下载的数据复制到与Internet连接的计算机中,因此我希望我可以在本地包装必要的文件,然后点CARGO.TOML 到该位置。
这可能吗?如果是这样,怎么样?
I would like to use the tango client crate for a Rust project at work, however the environment that I will be developing this in does not have direct access to the internet. This means that the standard method of adding the dependency to Cargo.toml
and running cargo build
fails due to a network error.
The environment doesn't prevent me from copying data downloaded to an internet-connected computer, and so I was hoping that there would be a way for me to package the necessary files locally, and then point Cargo.toml
to that location.
Is this possible? If so, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
回答我自己的问题,这要归功于@dogbert的评论中的提示。
诀窍是在具有Internet连接的机器上使用
货物供应商
。这将产生一个称为供应商
的目录,该目录可以转移到其他环境中。在该环境以及将运行货物构建
的目录中,在.cargo/config
中创建一个新文件。完成此操作后,
货物构建
应该有效。Answering my own question, thanks to a tip in a comment from @Dogbert.
The trick was to use
cargo vendor
on the machine that has an internet connection. This will produce a directory calledvendor
that can be transferred to the other environment. On that environment, and within the directory from which you will runcargo build
, create a new file in.cargo/config
.Once you've done this, then
cargo build
should work.