无法加载依赖项清单文件。

3
2个回答

2

如果你运行cargo check,你会得到以下结果:

error: failed to load manifest for workspace member `/root/cumulus/pallets/dex`

Caused by:
  failed to load manifest for dependency `acala-primitives`

Caused by:
  failed to load manifest for dependency `module-evm-utiltity`

Caused by:
  failed to read `/root/cumulus/primitives/modules/evm-utiltity/Cargo.toml`

Caused by:
  No such file or directory (os error 2)

问题在于/root/cumulus/primitives/modules/evm-utiltity/Cargo.toml未找到,因为您未将此pallet包含在本地或该pallet被放错位置并位于其他地方。
简单的解决方案:
1. 定位和更正
找到pallet所在位置,并正确链接到它,或将pallet导入到位置root/cumulus/primitives/modules/evm-utiltity/Cargo.toml,以便可以找到它。
2. 外部链接而不是本地导入pallets
您可以从其外部来源链接到pallet,而不是在本地导入它,否则您将发现需要采取更多的依赖关系并将它们存储在本地,就像上面提到的错误中的/root/cumulus/primitives/modules/evm-utiltity/Cargo.toml一样。
您可以这样做:
直接转到运行时目录,即/root/cumulus/parachain-template/runtime/Cargo.toml,并直接从github.com/acala-network/acala链接到外部dex,类似于以下内容:
[dependencies.pallet-dexl]
default-features = false
git = 'https://github.com/Acala-Network/acala.git'
branch = polkadot-v0.9.13
version = '3.0.0'

实际上它仍然使用旧的依赖版本,就像这样:

pallet-dex = { git = "https://github.com/Acala-Network/acala", default-features = false, branch = "polkadot-v0.9.13" }

对于这个错误,需要更加具体的设置:

module-evm-utlity = { git = "https://github.com/Acala-Network/acala", default-features = false, branch = "polkadot-v0.9.13" }

但是如果您从外部源链接到pallet-dex,错误应该会消失,并且您可能不需要链接 acala-primitives 或者 module-evm-utility

https://docs.substrate.io/how-to-guides/v3/basics/pallet-integration/

此外,evm-utiltity 拼写不正确(应该是 utility)。


更合理的做法是从外部导入dex托盘。所以我添加了以下内容:[dependencies.module-dex] default-features = false git = 'https://github.com/AcalaNetwork/Acala.git' branch = 'release-acala-2.0.3' version = '2.0.3'如你建议的,将其添加到 runtime/Cargo.toml 中。这次我遇到了不同的问题,请查看下面的图片:https://i.stack.imgur.com/l5Rsa.png - P.E
确保您不依赖于两个不同版本的基板。这会导致此类错误。 - Squirrel

0

我解决这个错误的方法是在我的货物文件中将正确的分支值从.17更改为.18。对于sp-io依赖项,我设置了branch = "polkadot-v0.9.17",这与其他所有依赖项所在的polkadot-v0.9.18版本不匹配。

原始文本中存在sp-io问题(最后一行)

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
    "derive",
] }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
frame-support = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18"}
frame-system = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
frame-benchmarking = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18", optional = true }
sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.17" }

修复(sp-io)

sp-io = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }

现在"branch"与其他所有内容匹配,我的错误已经消失了!我回到Substrate Kitties教程中继续学习!


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接