Unable to execute "trunk serve"

6.6k views Asked by At

I was getting into Rust and looking at these simple instructions for Yew framework (a frontend framework for Rust): https://yew.rs/docs/tutorial.

I followed the instructions up until the command

trunk serve --open

However, something somewhere fails.

This is what I'm getting:

2022-05-06T19:07:54.087214Z  INFO  starting build
2022-05-06T19:07:54.087870Z  INFO spawning asset pipelines
2022-05-06T19:07:54.168329Z  INFO building yew-app
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
2022-05-06T19:07:54.232154Z  INFO fetching cargo artifacts
2022-05-06T19:07:54.295124Z  INFO processing WASM for yew-app
2022-05-06T19:07:54.301974Z  INFO downloading wasm-bindgen version="0.2.80"
2022-05-06T19:07:54.302269Z ERROR ❌ error
error from HTML pipeline

Caused by:
    0: error from asset pipeline
    1: failed downloading release archive
    2: unsupported architecture
2022-05-06T19:07:54.302531Z  INFO  serving static assets at -> /
2022-05-06T19:07:54.302591Z  INFO  server listening at http://127.0.0.1:8080

This is my Cargo.toml file:

[package]
name = "yew-app"
version = "0.1.0"
edition = "2021"

[dependencies]
yew = "0.19"

Output after I run rustup target list --installed command:

aarch64-apple-darwin
wasm32-unknown-unknown

Machine: M1 Mac (with Apple Silicon chip)

Rust version: 1.60.0

trunk version: 0.15.0

Any help would be appreciated as I'm just getting into Rust and Web Assembly.

1

There are 1 answers

3
Unapiedra On BEST ANSWER

Fix it by installing wasm-bindgen-cli:

cargo install --locked wasm-bindgen-cli

This is mentioned in this PR on trunk's GitHub: https://github.com/thedodd/trunk/pull/375