Wasm-bindgen: Compilation of the example fails

Created on 4 Oct 2018  Â·  4Comments  Â·  Source: rustwasm/wasm-bindgen

I'm trying to compile the example at https://rustwasm.github.io/wasm-bindgen/whirlwind-tour/basic-usage.html but the compilation fails:

$ cargo +nightly build --target wasm32-unknown-unknown
   Compiling wasm-bindgen v0.2.23
error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: Could not compile `wasm-bindgen`.

To learn more, run the command again with --verbose.

Let me know if you need more informations.

Most helpful comment

Thanks for the report! It looks like the wasm target isn't added for your toolchain, and I think this should fix the issue:

$ rustup target add wasm32-unknown-unknown --toolchain nightly

All 4 comments

Thanks for the report! It looks like the wasm target isn't added for your toolchain, and I think this should fix the issue:

$ rustup target add wasm32-unknown-unknown --toolchain nightly

Hi @alexcrichton I have the same Issue, and I already run following command:
rustup target add wasm32-unknown-unknown --toolchain nightly
and the command's result as following:
info: component 'rust-std' for target 'wasm32-unknown-unknown' is up to date
but still occurrus the issue:
error[E0463]: can't find crate forcore | = note: thewasm32-unknown-unknowntarget may not be installed error: aborting due to previous error

@Itanq oh it looks like you added the wasm target to the nightly toolchain, so you'll need to make sure any build commands are prefixed with rustup run nightly ...

ADD this once: rustup target add wasm32-unknown-unknown --toolchain nightly
SOLUTION :
rustup run nightly cargo build --target wasm32-unknown-unknown

Was this page helpful?
0 / 5 - 0 ratings