Error installing serde_json dependency in linux

69 views Asked by At

I write Rust code on windows, and then I send it to the VPS server on which Debian GNU/Linux 11 is installed. When building the project, I get an error related to the installation of serde_json:

error: failed to download `serde_json v1.0.107`

Caused by:
  unable to get packages from source

Caused by:
  failed to parse manifest at `/root/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_json-1.0.107/Cargo.toml`

Caused by:
  failed to parse the `edition` key

Caused by:
  this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.

My Cargo.toml:

[package]
name = "hello_rust"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = "1.0"
serde_json = "1.0"

I tried updating cargo using cargo update. And also delete the serde_json and serge folders in `/root/.cargo/registry/src/github... / ... From the strange, I don't have rustup installed together with cargo and rust. I also tried to explicitly change the versions of serde_json, but the same error still came out. I don't understand what could be the reason, please help.

0

There are 0 answers