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



我正在学习基质和

我只是在学习教程。

关于第二个教程(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(,它还可以…

我遇到了同样的错误。通过这种方法解决:而不是添加:";托盘缺口={默认功能=错误,版本=‘3.0.0’,git=‘https://github.com/paritytech/substrate.git',tag='monthly-2021-05'}";在你的cargo.toml中,只需添加";托盘缺口={默认特征=false,版本=‘3.0.0’}";。

我没有完全相同的错误,但在同一个教程中,这是由于与更新版本的衬底和教程的兼容性问题,我通过使所有依赖项在环境中兼容来解决这个问题(希望您已经构建好了(:

cargo update