错误:无法为 `syn` 选择版本

发布于 2025-01-11 02:21:32 字数 1823 浏览 4 评论 0原文

error: failed to select a version for `syn`. \
    ... required by package `serde_derive v1.0.125`\
    ... which satisfies dependency `serde_derive = "=1.0.125"` of package `serde v1.0.125`    
    ... which satisfies dependency `serde = "^1.0.125"` of package `mongodb v2.1.0`\
    ... which satisfies dependency `mongodb = "^2.1"` of package `wagmeet v0.1.0 
 \(/mnt/e/College/Eighth Semester/Crypto_Capable/wagmeet_app)`\
versions that meet the requirements `^1.0.60` are: 1.0.86, 1.0.85, 1.0.84, 1.0.83, 1.0.82, 1.0.81, 1.0.80, 1.0.79, 1.0.78, 1.0.77, 1.0.76, 1.0.75, 1.0.74, 1.0.73, 1.0.72, 1.0.71, 1.0.70, 1.0.69, 1.0.68, 1.0.67, 1.0.66, 1.0.65, 1.0.64, 1.0.63, 1.0.62, 1.0.61, 1.0.60

all possible versions conflict with previously selected packages.

  previously selected package `syn v1.0.57`\
    ... which satisfies dependency `syn = "=1.0.57"` 
    \ of package `near-sdk-core v3.0.1`
    ... which satisfies dependency `near-sdk-core = "=3.0.1"` of package `near-sdk-macros v3.0.1` \
    ... which satisfies dependency `near-sdk-macros = "=3.0.1"` \ of package `near-sdk v3.0.1`   
    ... which satisfies dependency `near-sdk = "^3"` of package `wagmeet v0.1.0 `\

failed to select a version for `syn` which could resolve this conflict

Cargo.toml 文件

[package]
name = "wagmeet"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["rlib","cdylib"]

[dependencies]
near-sdk = "^3.1.0"
near-contract-standards = "^3.1.1"
mongodb = "2.0.0"
bson = { version = "2", features = ["chrono-0_4"] } # Needed for using chrono datetime in doc
tokio = "1"
chrono = "0.4" # Used for setting DateTimes
serde = "1"
serde_derive = "1.0.135"
  • 更新 添加了cargo.toml 文件

我尝试了各种版本,但目前似乎没有任何效果。 mongoDb 是否兼容近协议?

error: failed to select a version for `syn`. \
    ... required by package `serde_derive v1.0.125`\
    ... which satisfies dependency `serde_derive = "=1.0.125"` of package `serde v1.0.125`    
    ... which satisfies dependency `serde = "^1.0.125"` of package `mongodb v2.1.0`\
    ... which satisfies dependency `mongodb = "^2.1"` of package `wagmeet v0.1.0 
 \(/mnt/e/College/Eighth Semester/Crypto_Capable/wagmeet_app)`\
versions that meet the requirements `^1.0.60` are: 1.0.86, 1.0.85, 1.0.84, 1.0.83, 1.0.82, 1.0.81, 1.0.80, 1.0.79, 1.0.78, 1.0.77, 1.0.76, 1.0.75, 1.0.74, 1.0.73, 1.0.72, 1.0.71, 1.0.70, 1.0.69, 1.0.68, 1.0.67, 1.0.66, 1.0.65, 1.0.64, 1.0.63, 1.0.62, 1.0.61, 1.0.60

all possible versions conflict with previously selected packages.

  previously selected package `syn v1.0.57`\
    ... which satisfies dependency `syn = "=1.0.57"` 
    \ of package `near-sdk-core v3.0.1`
    ... which satisfies dependency `near-sdk-core = "=3.0.1"` of package `near-sdk-macros v3.0.1` \
    ... which satisfies dependency `near-sdk-macros = "=3.0.1"` \ of package `near-sdk v3.0.1`   
    ... which satisfies dependency `near-sdk = "^3"` of package `wagmeet v0.1.0 `\

failed to select a version for `syn` which could resolve this conflict

Cargo.toml file

[package]
name = "wagmeet"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["rlib","cdylib"]

[dependencies]
near-sdk = "^3.1.0"
near-contract-standards = "^3.1.1"
mongodb = "2.0.0"
bson = { version = "2", features = ["chrono-0_4"] } # Needed for using chrono datetime in doc
tokio = "1"
chrono = "0.4" # Used for setting DateTimes
serde = "1"
serde_derive = "1.0.135"
  • Update
    added the cargo.toml file

I have tried various versions nothing seems to be working for now. Is mongoDb even compatible with Near protocol?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

作死小能手 2025-01-18 02:21:32

您的两个依赖项之间存在冲突:near-sdk 需要完全 syn 版本1.0.57,并且mongodb 需要至少 syn 版本 1.0.60。显然两者不能共存。

您有几个解决方案:

  • 修补 near-sdk 以支持更高的 syn 版本。通常不建议这样做。
  • near-sdk 升级到预发行版 4.0.0 (当前为 4.0.0-pre.7),支持更高的 syn 版本。这是一个不稳定的版本,可能会崩溃。
  • mongodb 降级到支持 syn 版本 1.0.57 的版本。支持该功能的最新版本是 1.2.5,因此您需要在 Cargo.toml 中指定 mongodb = "=1.2.5"。但这依赖于不受支持的旧版本。

不存在“最佳解决方案”。所有的解决方案都是不好的。我可能会将 near-sdk 升级到 4.0.0,但具体做什么取决于您的需求。

There is a conflict between two of your dependencies: near-sdk requires exactly syn version 1.0.57, and mongodb requires at least syn version 1.0.60. Clearly both cannot exist together.

You have few solutions:

  • Patch near-sdk to support later syn versions. This is usually not recommended.
  • Upgrade near-sdk to the pre-release 4.0.0 (currently 4.0.0-pre.7) that supports later syn versions. This is an unstable version, and may break.
  • Downgrade mongodb to a version that supports syn version 1.0.57. The latest version that supports that is 1.2.5, so you need to specify in your Cargo.toml mongodb = "=1.2.5". But this relies on an old, unsupported version.

There is no "best solution". All solutions are bad. I would probably upgrade near-sdk to 4.0.0, but what to do depends on your needs.

迷爱 2025-01-18 02:21:32

当我添加 git 依赖项时出现此错误。运行

cargo update

解决了问题。

更多信息:

我得到的错误是:

all possible versions conflict with previously selected packages.

  previously selected package `bytemuck v1.13.1`
    ... which satisfies dependency `bytemuck = "^1.7"` (locked to 1.13.1) of package `eframe v0.23.0`
    ... which satisfies dependency `eframe = "^0.23.0"` (locked to 0.23.0) of package `myproject v1.4.0 

failed to select a version for `bytemuck` which could resolve this conflict

然后货物更新导致:

Updating crates.io index
    Updating git repository `https://github.com/huggingface/candle.git`
    Updating ab_glyph v0.2.21 -> v0.2.23
    Updating accesskit v0.11.0 -> v0.11.2
    Updating accesskit_consumer v0.15.0 -> v0.15.2
    Updating accesskit_macos v0.7.1 -> v0.9.0
    Updating accesskit_unix v0.5.0 -> v0.5.2
    Updating accesskit_windows v0.14.0 -> v0.14.3
    Updating accesskit_winit v0.14.1 -> v0.14.4
      Adding addr2line v0.21.0
    ... and a whole lot more of Updating, Adding, and Removing.

I got this error when I added a git dependency. Running

cargo update

fixed the problem.

More info:

The error I got was:

all possible versions conflict with previously selected packages.

  previously selected package `bytemuck v1.13.1`
    ... which satisfies dependency `bytemuck = "^1.7"` (locked to 1.13.1) of package `eframe v0.23.0`
    ... which satisfies dependency `eframe = "^0.23.0"` (locked to 0.23.0) of package `myproject v1.4.0 

failed to select a version for `bytemuck` which could resolve this conflict

and then cargo update resulted in:

Updating crates.io index
    Updating git repository `https://github.com/huggingface/candle.git`
    Updating ab_glyph v0.2.21 -> v0.2.23
    Updating accesskit v0.11.0 -> v0.11.2
    Updating accesskit_consumer v0.15.0 -> v0.15.2
    Updating accesskit_macos v0.7.1 -> v0.9.0
    Updating accesskit_unix v0.5.0 -> v0.5.2
    Updating accesskit_windows v0.14.0 -> v0.14.3
    Updating accesskit_winit v0.14.1 -> v0.14.4
      Adding addr2line v0.21.0
    ... and a whole lot more of Updating, Adding, and Removing.
记忆で 2025-01-18 02:21:32

当您使用指向不同版本的依赖项的工作区和多个 toml 文件时,可能会出现这种情况。当您在 bin 项目中使用依赖项时,它们会发生冲突并将错误转储给您。

确保所有依赖项都指向相同的 lib 版本并运行 cargo update

This can be the case when you're using workspaces and multipe toml files that point to different versions of a dependency. When you're using the dependency in your bin project they collide and dump that error on you.

Make sure all dependencies point to the same lib version and run cargo update

我偏爱纯白色 2025-01-18 02:21:32

尝试以下方法...

  • 如果您使用其他项目的 Cargo.lock ,请检查您的修补依赖项是否指向正确的源存储库
  • ,或者随时更改一些依赖项,删除目标文件夹并再次构建,
  • 检查编译日志是否有不正确的依赖项路径!
  • 更新你的 Rust
  • 删除 .cargo 和 .rustup 目录

Try the following methods...

  • check your patched dependencies are pointed to the correct source repository
  • if you use other project's Cargo.lock or change some dependencies as you go, remove target folder and build again
  • check compilation logs for incorrect dependency paths!
  • update your Rust
  • delete .cargo and .rustup directories
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文