solana/锚定错误:(划定依赖关系)未能获得包装元数据:`货运元数据带有错误:更新Crates.io index
我昨天刚刚设置了一个新的锚点项目,每个命令运行顺利。
今天,我安装了一个新的锚点项目。我运行锚测试
查看项目是否正确设置。我遇到了这个错误:
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
package.json
中的依赖性不是问题,这是由于使用了Yanked Rust Crateadnakor-lang
所有其他版本
0.24.2 已被拉紧,因此您无法构建任何具有依赖的货物项目。
请参阅此处 https://crates.io/crates/crates/anchor-lang/versions 您需要使它工作是
转到
< your-project-root>/programs/myanchorproject/cargo.toml
。我假设您的程序名称为
myanchorProject
或用您的程序名称替换。您当前的CARGO.TOML必须看起来像
您需要将锚式版本升级到
0.24.2
或任何其他版本(如果可用)。因此,您的最终货物。汤姆尔应该看起来像
It's not the problem with dependency in your
package.json
is due to the use of yanked rust crateanchor-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
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