1

The error described below is produced when attempting to compile the node upgraded to v3. The Cargo.toml files indeed specify the js feature; the issue occurs when compiling packages within Cargo.lock, which include the getrandom package. As getrandom is the direct dependency of those packages, I am not sure how to specify js feature for them as well. Please let me know what can be done to resolve this issue.

Compiling getrandom v0.2.6 error: the wasm32-unknown-unknown target is not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support --> /Users/raid/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.6/src/lib.rs:235:9 | 235 | / compile_error!("the wasm32-unknown-unknown target is not supported by
236 | | default, you may need to enable the "js" feature.
237 | | For more information see:
238 | | https://docs.rs/getrandom/#webassembly-support"); | |________________________________________________________________________^

1
  • I’m voting to close this question because no more active.
    – AurevoirXavier
    Aug 29, 2022 at 1:49

1 Answer 1

1

I would assume that this error comes from the new try-runtime feature, which wasn't correctly added to the substrate-node-template.

At least when I run cargo check --all-features on a fresh substrate-node-template then it returns cannot find trait TryRuntime in crate frame_try_runtime.

I fixed this by going into runtime/Cargo.toml and adding the following. This would exclude the standard library to properly work with WASM.

std = [
    ...
    "frame-try-runtime/std",
    ...
]

Please double check if you have the following package in your runtime/Cargo.toml with default-features = false:

frame-try-runtime = { ..., default-features = false, git = "https://github.com/paritytech/substrate.git", ... }

Make sure that you don't have the try-runtime-cli dependency in runtime/Cargo.toml.

If this doesn't help, then please try to give additional information about how to reproduce the error. Which substrate-node-template version did you run?

2
  • I created a pull request for this here.
    – Chralt
    May 24, 2022 at 20:03
  • Also look at this
    – Chralt
    May 24, 2022 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.