-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Description
Environment
rustc 1.91.1 (ed61e7d7e 2025-11-07)
Windows 11-x64
All current updates applied
Issue
When trying trunk serve on Windows I got following compiler error:
error: the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
--> C:\Users\piotr\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\getrandom-0.2.16\src\lib.rs:346:9
|
346 | / compile_error!("the wasm*-unknown-unknown targets are not supported by \
347 | | default, you may need to enable the \"js\" feature. \
348 | | For more information see: \
349 | | https://docs.rs/getrandom/#webassembly-support");
| |________________________________________________________________________^
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `imp`
--> C:\Users\piotr\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\getrandom-0.2.16\src\lib.rs:402:9
|
402 | imp::getrandom_inner(dest)?;
| ^^^ use of unresolved module or unlinked crate `imp`
|
= help: if you wanted to use a crate named `imp`, use `cargo add imp` to add it to your `Cargo.toml`
For more information about this error, try `rustc --explain E0433`.
error: could not compile `getrandom` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Solution
It can be fixed by adding getrandom = { version = "*", features = ["js"]} to Cargo.toml
Metadata
Metadata
Assignees
Labels
No labels