【问题标题】:Unable to build Rocket.rs: The given version requirement is invalid无法构建 Rocket.rs:给定的版本要求无效
【发布时间】:2017-12-25 08:27:41
【问题描述】:

我正在关注the Rocket getting started guide 来学习 Rust 的 Rocket Web 框架。当我执行cargo run --verbose 时出现以下错误:

PS C:\Users\kin\Desktop\hello-rocket> cargo run --verbose
Updating registry `https://github.com/rust-lang/crates.io-index`
failed to parse registry's information for: serde

Caused by:
  the given version requirement is invalid

系统详情

Desktop Environment:   Windows 10
Cargo Version      :   cargo 0.8.0-nightly (28a0cbb 2016-01-17)
rustc Version      :   rustc 1.7.0 (a5d1e7a59 2016-02-29)

Cargo.toml

[package]
name = "hello-rocket"
version = "0.1.0"
authors = ["XXX"]

[dependencies]
rocket = "0.3.5"
rocket_codegen = "0.3.5"

【问题讨论】:

  • 问这个问题最好的地方是rocket issues page
  • 什么版本的 Rust?什么版本的货物? Cargo.toml 中有什么内容?

标签: rust rust-cargo rust-rocket


【解决方案1】:

我正在关注 Rocket 入门指南

very first section of the guide you linked 到各州(强调我的):

Rocket 充分利用了 Rust 的语法扩展和其他高级的、不稳定的特性。因此,我们需要使用夜间版本的 Rust

稍后,它指出:

Rocket 总是需要 Rust 的最新版本 nightly

然而你有一个稳定版本的 Rust (1.7.0);此时(2016-02-29)几乎 22 个月大。 Rust 1.22.1 是 Rust 当前的稳定版本。

该指南继续描述如何安装最新的 nightly;我建议关注它。

【讨论】:

  • 无法在 Windows PowerShell 中使用 rustup update 升级 Rustc。我终于通过使用 rustup‑init.exe 安装程序重新安装 Rust 解决了这个问题。
【解决方案2】:

【讨论】:

    猜你喜欢
    • 2020-03-17
    • 2021-10-06
    • 1970-01-01
    • 2018-06-25
    • 1970-01-01
    • 2018-09-06
    • 2020-01-28
    • 2021-05-30
    • 2020-07-09
    相关资源
    最近更新 更多