Unable to execute "trunk serve"
Asked Answered
P

1

10

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.

Philippines answered 6/5, 2022 at 19:27 Comment(2)
I can reproduce this on M1 Mac as well. – Lankester
I guess this is the solution: github.com/thedodd/trunk/pull/375 – Lankester
L
11

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

Lankester answered 6/5, 2022 at 19:45 Comment(3)
Correct, it compiles and serves successfully now, thank you! – Philippines
@Unapiedra, does it typically take awhile to install wasm-bindgen-cli? – Sihunn
@Unapiedra, installing wasm-bindgen-cli did not resolve my issue of running trunk serve. – Sihunn

© 2022 - 2024 β€” McMap. All rights reserved.