rustwebassemblytoolchaindioxus

Rust E0463 building Dioxus Fullstack but wasm32-unknown-unknown Target is Installed


Running dx build --features web --release or cargo build --target wasm32-unknown-unknown returns the following error:

[INFO] 🚅 Running build command...
error: Broken pipe (os error 32)
Error: 🚫 Building project failed: error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

However, when I run rustup target add wasm32-unknown-unknown, it prints

info: component 'rust-std' for target 'wasm32-unknown-unknown' is up to date

The target appears to be installed when I run rustup show:

Default host: aarch64-apple-darwin
rustup home:  /Users/myhomedir/.rustup

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

aarch64-apple-darwin
wasm32-unknown-unknown

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

stable-aarch64-apple-darwin (default)
rustc 1.76.0 (07dca489a 2024-02-04)

I don't understand why the std lib isn't compiled for this target.


Solution

  • Turns out Rust was installed via both homebrew and rustup. Removing the homebrew installation fixed this. Credit to this answer: https://stackoverflow.com/a/74549777/22985331