首页 > 解决方案 > 将尼克托盘添加到基材时出错

问题描述

我刚刚开始探索基板,我正在关注本教程(https://docs.substrate.io/tutorials/v3/add-a-pallet/)。

在步骤下实现尼克斯托盘配置特征- >将尼克斯添加到construct_runtime!宏。,我将 Nicks 托盘添加到我的运行时,如屏幕截图所示。在此处输入图像描述

现在,当我运行时cargo check -p node-template-runtime,我得到了很多错误;

asad@asad-Z440:~/Dev/Blockchain/polkadot/substrate-node-template$ cargo check -p node-template-runtime
warning: /home/asad/Dev/Blockchain/polkadot/substrate-node-template/node/Cargo.toml: version requirement `3.0.0-monthly-2021-09+1` for dependency `node-template-runtime` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
warning: /home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime/Cargo.toml: version requirement `3.0.0-monthly-2021-09+1` for dependency `pallet-template` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
    Updating git repository `https://github.com/paritytech/substrate.git`
    Updating crates.io index
    Updating git repository `https://github.com/paritytech/substrate.git`
   Compiling node-template-runtime v3.0.0-monthly-2021-09+1 (/home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime)
error: failed to run custom build command for `node-template-runtime v3.0.0-monthly-2021-09+1 (/home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime)`

Caused by:
  process didn't exit successfully: `/home/asad/Dev/Blockchain/polkadot/substrate-node-template/target/debug/build/node-template-runtime-c9c48352bd7ed47e/build-script-build` (exit status: 1)
  --- stdout
  Information that should be included in a bug report.
  Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/home/asad/Dev/Blockchain/polkadot/substrate-node-template/target/debug/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--release"
  Using rustc version: rustc 1.57.0-nightly (aa7aca3b9 2021-09-30)


  --- stderr
  warning: /home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime/Cargo.toml: version requirement `3.0.0-monthly-2021-09+1` for dependency `pallet-template` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
      Updating git repository `https://github.com/paritytech/substrate.git`
     Compiling node-template-runtime v3.0.0-monthly-2021-09+1 (/home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime)
  warning: unused doc comment
     --> /home/asad/Dev/Blockchain/polkadot/substrate-node-template/runtime/src/lib.rs:253:1
      |
  253 | /// Nicks Config:
      | ^^^^^^^^^^^^^^^^^ rustdoc does not generate documentation for macro invocations
      |
      = note: `#[warn(unused_doc_comments)]` on by default
      = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion

  error: duplicate lang item in crate `sp_io` (which `frame_support` depends on): `panic_impl`.


.........

  310 | / construct_runtime!(
  311 | |     pub enum Runtime where
  312 | |         Block = Block,
  313 | |         NodeBlock = opaque::Block,
  ...   |
  327 | |     }
  328 | | );
      | |__^
  note: required by a bound in `sp_runtime::generic::UncheckedExtrinsic`
     --> /home/asad/.cargo/git/checkouts/substrate-7e08433d4c370a21/20a9bbb/primitives/runtime/src/generic/unchecked_extrinsic.rs:39:40
      |
  39  | pub struct UncheckedExtrinsic<Address, Call, Signature, Extra>
      |                                        ^^^^ required by this bound in `sp_runtime::generic::UncheckedExtrinsic`
      = note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

  For more information about this error, try `rustc --explain E0277`.
  warning: `node-template-runtime` (lib) generated 1 warning
  error: could not compile `node-template-runtime` due to 112 previous errors; 1 warning emitted

我尝试过的事情:
删除Cargo.lock文件,然后运行cargo check -p node-template-runtime​​.

PS:我只是从生锈和基材开始,所以如果我在这里问一些明显的问题,请原谅我。

标签: substratepolkadot

解决方案


推荐阅读