solana/锚定错误:(划定依赖关系)未能获得包装元数据:`货运元数据带有错误:更新Crates.io index

发布于 2025-01-24 12:09:50 字数 661 浏览 2 评论 0原文

我昨天刚刚设置了一个新的锚点项目,每个命令运行顺利。

今天,我安装了一个新的锚点项目。我运行锚测试查看项目是否正确设置。我遇到了这个错误:

Failed to obtain package metadata: `cargo metadata` exited with an error:     Updating crates.io index
error: failed to select a version for the requirement `anchor-lang = "^0.23.0"`
candidate versions found which didn't match: 0.24.2
location searched: crates.io index
required by package `myAnchorProject v0.1.0 (.../programs/myAnchorProject)`

尚不清楚候选版本的含义。我删除了node_modules,并使用“@project-serum/adnador”安装它:“^0.24.2”,仍然相同的错误。

我清除lib.rs和测试文件以查看不同的内容,但仍然会出现相同的错误。

执行货物更新正在给出相同的错误

I just set up a new anchor project yesterday, every command runs smoothly.

Today I installed a new anchor project. I run anchor test to see if the project is set up correctly. I am getting this error:

Failed to obtain package metadata: `cargo metadata` exited with an error:     Updating crates.io index
error: failed to select a version for the requirement `anchor-lang = "^0.23.0"`
candidate versions found which didn't match: 0.24.2
location searched: crates.io index
required by package `myAnchorProject v0.1.0 (.../programs/myAnchorProject)`

It is not clear what candidate versions mean. I deleted node_modules and install it with "@project-serum/anchor": "^0.24.2", still same error.

I clear the lib.rs and testing file to see something different, but it still gives the same error.

executing cargo update is giving same error

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

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

发布评论

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

评论(1

只为一人 2025-01-31 12:09:50

package.json中的依赖性不是问题,这是由于使用了Yanked Rust Crate adnakor-lang

所有其他版本0.24.2 已被拉紧,因此您无法构建任何具有依赖的货物项目。

请参阅此处 https://crates.io/crates/crates/anchor-lang/versions 您需要使它工作是
转到< your-project-root>/programs/myanchorproject/cargo.toml
我假设您的程序名称为myanchorProject或用您的程序名称替换。

您当前的CARGO.TOML必须看起来像

...
<other content goes here>
...

[dependencies]
anchor-lang = "^0.23.0"

您需要将锚式版本升级到0.24.2或任何其他版本(如果可用)。

因此,您的最终货物。汤姆尔应该看起来像

...
<other content goes here>
...

[dependencies]
anchor-lang = "^0.24.2"

It's not the problem with dependency in your package.json is due to the use of yanked rust crate anchor-lang

all the other version the 0.24.2 have been yanked so you can't build any cargo project which has yanked dependeny.

refer here https://crates.io/crates/anchor-lang/versions

what you need to do get it working is
go to <your-project-root>/programs/myAnchorProject/cargo.toml.
I'm assuming your program name is myAnchorProject or replace it with your program name.

your current cargo.toml must look something like

...
<other content goes here>
...

[dependencies]
anchor-lang = "^0.23.0"

you need to upgrade the anchor-lang version to 0.24.2 or any other version if available which is not yanked.

so your final cargo.toml should look like

...
<other content goes here>
...

[dependencies]
anchor-lang = "^0.24.2"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文