我在 Cargo.toml
中使用 Git URL 引用 Rust 库的依赖项,就像这样:
rust_wheel = { git = "https://github.com/jiangxiaoqiang/rust_wheel.git" }
现在我已经改变了git仓库,并想要更新我的当前项目所依赖的组件。我尝试使用以下命令:
cargo install rust_wheel --force
但是它显示了这个错误:
error: there is nothing to install in `rust_wheel v0.1.0`, because it has no binaries
`cargo install` is only for installing programs, and can't be used with libraries.
To use a library crate, add it as a dependency in a Cargo project instead.
我尝试在Clion中刷新货物依赖项,但没有成功。我该怎么做才能更新依赖项?还尝试过命令cargo update rust_wheel
。
cargo install
是用于全局安装可运行二进制文件的命令,而不是操作当前项目的依赖关系。 (npm
是这样做的,对吗?我觉得这很奇怪。)cargo update
应该就可以了。但是如果您想确保拥有最新版本,可以指定rev="ba9d9ebed10fa5e213ec5a0845dab534225fa0a0"
。 - Caesar