Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wottpal opened this issue Nov 25, 2022 · 8 comments
Closed

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

wottpal opened this issue Nov 25, 2022 · 8 comments

Comments

@wottpal
Copy link

wottpal commented Nov 25, 2022

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.

@ganesh1997oli
Copy link

Exactly, I'm also facing same issue

@athei
Copy link
Member

athei commented Nov 29, 2022

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

@Chengcheng-S
Copy link

Chengcheng-S commented Nov 29, 2022

@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`

@amrm121
Copy link

amrm121 commented Nov 29, 2022

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...

@amrm121
Copy link

amrm121 commented Nov 29, 2022

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

@wottpal
Copy link
Author

wottpal commented Feb 24, 2023

Can be closed I think.

@wottpal wottpal closed this as completed Feb 24, 2023
@ganesh1997oli
Copy link

Can be closed I think.

yes now it works fine🙂

1 similar comment
@ganesh1997oli
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants