Rust wasm32 target not installed in CI
A --target wasm32-... build failed because that target's precompiled std is not installed. rustup ships host std by default; cross targets like wasm32 must be added explicitly before cargo can build for them.
What this error means
The build fails with error[E0463]: can't find crate for std`` plus a note that the wasm32 target may not be installed. It is deterministic until the target is added.
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`Common causes
wasm32 target not added
The runner has only the host target's std; --target wasm32-unknown-unknown has no std to link against until the target is installed.
Target added to the wrong toolchain
If rustup target add ran against a different toolchain than the build uses, the active toolchain still lacks the wasm32 std.
How to fix it
Add the wasm32 target
Install the precompiled std for the toolchain CI builds with.
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown --lockedPin the toolchain so the target matches
Add the target to the same channel the build uses.
rustup target add wasm32-unknown-unknown --toolchain stableHow to prevent it
- Add every cross target (wasm32, etc.) before building for it in CI.
- Install the target against the same toolchain the build selects.
- Cache the rustup target so it does not re-download each run.