Skip to content

Installation fails with: could not find derive_prelude in swarm #163

Closed

Description

@wottpal

I tried installing the most recent substrate-contracts-node with

cargo install contracts-node --force --git https://github.com/paritytech/substrate-contracts-node.git   

…and it fails with the following error:

   Compiling sc-network v0.10.0-dev (https://github.com/paritytech/substrate?branch=polkadot-v0.9.32#5ea6d953)
error[E0433]: failed to resolve: could not find `derive_prelude` in `swarm`
  --> /Users/wottpal/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
   |
58 | #[derive(NetworkBehaviour)]
   |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
   |
   = note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0432]: unresolved import `libp2p`
  --> /Users/wottpal/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
   |
58 | #[derive(NetworkBehaviour)]
   |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
   |
   = note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)

I brew-installed protobuf before, so it's not a duplicate of #161.

Before, I used v0.21.0 for WeightsV1, which installed successfully.

Activity

  1. ganesh1997oli commented on Nov 29, 2022

    @ganesh1997oli

    Exactly, I'm also facing same issue

  2. athei commented on Nov 29, 2022

    @athei
    Member

    I can reproduce. It is probably a dependency that violates semver. Add the --locked flag to the installation command line.

  3. Marky-Shi commented on Nov 29, 2022

    @Marky-Shi

    @athei When compiling the substrate node is also encountering the same problem

    the command cargo build --locked -p file://RustCode/parachain/node#my-node@0.01-release

     Compiling sc-network v0.10.0-dev (https://github.com/paritytech/substrate?branch=polkadot-v0.9.32#5ea6d953)
     Compiling sc-informant v0.10.0-dev (https://github.com/paritytech/substrate?branch=polkadot-v0.9.32#5ea6d953)
    error[E0433]: failed to resolve: could not find `derive_prelude` in `swarm`
      --> /root/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
       |
    58 | #[derive(NetworkBehaviour)]
       |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
       |
       = note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)
    
    error[E0432]: unresolved import `libp2p`
      --> /root/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
       |
    58 | #[derive(NetworkBehaviour)]
       |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
    
  4. amrm121 commented on Nov 29, 2022

    @amrm121

    Got the same error, when compiling my Parachain node with the contracts pallet.
    Using the sc-network in v0.9.32.

    error[E0433]: failed to resolve: could not find `derive_prelude` in `swarm`
      --> /home/amrm/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
       |
    58 | #[derive(NetworkBehaviour)]
       |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
       |
       = note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)
    
    error[E0432]: unresolved import `libp2p`
      --> /home/amrm/.cargo/git/checkouts/substrate-7e08433d4c370a21/5ea6d95/client/network/src/behaviour.rs:58:10
       |
    58 | #[derive(NetworkBehaviour)]
       |          ^^^^^^^^^^^^^^^^ could not find `derive_prelude` in `swarm`
       |   = note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)
    
    Some errors have detailed explanations: E0432, E0433.
    For more information about an error, try `rustc --explain E0432`.
    error: could not compile `sc-network` due to 2 previous errors
    warning: build failed, waiting for other jobs to finish...
    
  5. amrm121 commented on Nov 29, 2022

    @amrm121

    Hey, it was a bug in the libp2p. libp2p/rust-libp2p#3178
    Fixed by executing a cargo clean and deleting my cargo.lock. And after, just did a cargo build --release
    SE Discussion

  6. wottpal commented on Feb 24, 2023

    @wottpal
    Author

    Can be closed I think.

  7. ganesh1997oli commented on Feb 24, 2023

    @ganesh1997oli

    Can be closed I think.

    yes now it works fine🙂

  8. ganesh1997oli commented on Feb 24, 2023

    @ganesh1997oli

    Can be closed I think.

    yes now it works fine🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions