wasm-pack-plugin: Error compiling crate

Hello. Just running the example with the following traceback:

$ yarn start
yarn run v1.10.1
warning package.json: No license field
$ webpack -dw
ℹ️  Compiling your crate...


webpack is watching the files…

wasm-pack error: Compiling your crate to WebAssembly
Caused by: Process exited with exit code: 101: `cargo build` did not exit successfully.

stdout:

stderr:

   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.

Further, it can’t resolve ‘./pkg’ in the index.js. I am assuming this is generated when the compilation is successful.

rustc 1.31.0-nightly (2c2e2c57d 2018-10-12) wasm-pack 0.5.1

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Also wanted to say thanks. I use webpack extensively and this is going to help for the future. Between rust and go wasm, its going to help bring speed to some code.

You don’t have the wasm32-unknown-unknown target installed. Try this:

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

Then try again. 😉

So installing wasm-bindgen directly:

$ cargo install wasm-bindgen
    Updating crates.io index
  Installing wasm-bindgen v0.2.25                                                                             
error: specified package has no binaries

and $which wasm-bingen is not giving me a cargo bin path. I get nothing there.