由于日志版本,无法添加托盘缺口

问题描述

我正在学习基板和

我只是在学习教程。

在第二个教程 (https://substrate.dev/docs/en/tutorials/add-a-pallet/import-a-pallet) 中,由于以下错误,我无法继续。

Execution Failed (exit code 101).
/Users/~~~/.cargo/bin/cargo Metadata --verbose --format-version 1 --all-features
stdout :     Updating git repository `https://github.com/paritytech/substrate.git`
    Updating crates.io index
error: Failed to select a version for `log`.
    ... required by package `frame-support v3.0.0 (https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc)`
    ... which is depended on by `pallet-nicks v3.0.0 (https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc)`
    ... which is depended on by `node-template-runtime v3.0.0 (/Users/~~~/projects/substrate-node-template/runtime)`
    ... which is depended on by `node-template v3.0.0 (/Users/~~~/projects/substrate-node-template/node)`
versions that meet the requirements `^0.4.14` are: 0.4.14

all possible versions conflict with prevIoUsly selected packages.

  prevIoUsly selected package `log v0.4.13`
    ... which is depended on by `finality-grandpa v0.13.0`
    ... which is depended on by `sc-finality-grandpa v0.9.0`
    ... which is depended on by `node-template v3.0.0 (/Users/~~~/projects/substrate-node-template/node)`

Failed to select a version for `log` which Could resolve this conflict

stderr : 

当我在 runtime/Cargo.toml 上添加关于教程内容的托盘缺口和功能时,就会发生这种情况。

到那时就好了。

解决方法

我找到了解决方法,它是在cargo.toml上手动添加日志依赖,如下所示

# cargo.toml
log = '^0.4.14'

一切正常,但我在下一步后遇到另一个问题(配置后无法构建)所以我只使用了答案分支(add-a-pallet-v3.0.0+monthly-2021-05),结果是好的....

,

我遇到了同样的错误。用这个方法解决了: 而不是添加:“pallet-nicks = { default-features = false,version = '3.0.0',git = 'https://github.com/paritytech/substrate.git',tag = 'monthly-2021-05 ' }" 在您的cargo.toml 中,只需添加"pallet-nicks = { default-features = false,version = '3.0.0'}"。