Wasm-bindgen: error[E0463]: can't find crate for `std`

Created on 11 Mar 2018  路  4Comments  路  Source: rustwasm/wasm-bindgen

This is my first experience using Rust so I may be missing an obvious setup step.
I'm following along with the README and I get an error when I run the cargo build command:

cargo build --release --target wasm32-unknown-unknown
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling itoa v0.3.4
   Compiling dtoa v0.4.2
   Compiling num-traits v0.2.1
   Compiling fnv v1.0.6
   Compiling wasm-bindgen-shared v0.1.1
   Compiling serde v1.0.29
   Compiling unicode-xid v0.1.0
   Compiling proc-macro2 v0.2.3
   Compiling quote v0.4.2
   Compiling syn v0.12.14
   Compiling serde_json v1.0.10
   Compiling serde_derive_internals v0.20.0
   Compiling serde_derive v1.0.29
   Compiling wasm-bindgen-macro v0.1.1
   Compiling wasm-bindgen v0.1.0
error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed

error: aborting due to previous error

If you want more information on this error, try using "rustc --explain E0463"
error: Could not compile `wasm-bindgen`.

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

This is the result of running rustup show:

 rustup show
Default host: x86_64-apple-darwin

installed toolchains
--------------------

stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin (default)

installed targets for active toolchain
--------------------------------------

wasm32-unknown-emscripten
wasm32-unknown-unknown
x86_64-apple-darwin

active toolchain
----------------

nightly-x86_64-apple-darwin (default)
rustc 1.26.0-nightly (2789b067d 2018-03-06)

I'd be happy to provide additional debugging information if needed.

Most helpful comment

I am facing the same problem now. And my Mac OS 10.14 doesn't have /usr/local/lib/rustlib in it. So I can not try the solution bantic attempted.

All 4 comments

Oh dear that seems bad! Are you perhaps using anything interesting for rustup/rustc/cargo? It looks like you've already run rustup target add wasm32-unknown-unknown, so it looks like something may be misconfigured along the way by accident...

Thanks for the quick response!
I uninstalled rust using sudo /usr/local/lib/rustlib/uninstall.sh and reinstalled and this time it did work for me. Great!

I am facing the same problem now. And my Mac OS 10.14 doesn't have /usr/local/lib/rustlib in it. So I can not try the solution bantic attempted.

Got here by searching the same problem. Solved with rustup target install wasm32-unknown-unknown
I had previously switched toolchains from beta to nightly, so maybe the std crate was missing for certain targets. Anyway hope it helps someone.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pustaczek picture pustaczek  路  3Comments

hunterlester picture hunterlester  路  4Comments

shepmaster picture shepmaster  路  3Comments

MarcAntoine-Arnaud picture MarcAntoine-Arnaud  路  3Comments

aschampion picture aschampion  路  4Comments