wasm-server-runner icon indicating copy to clipboard operation
wasm-server-runner copied to clipboard

wasm-bindgen scheme version error

Open UkoeHB opened this issue 10 months ago • 2 comments

The following error shows up periodically when using this project. The solution is to uninstall and reinstall wasm-server-runner (and possibly to update the wasm-bindgen-cli as instructed by the error message).

Error: 

it looks like the Rust project used to create this wasm file was linked against
version of wasm-bindgen that uses a different bindgen format than this binary:

  rust wasm file schema version: 0.2.100
     this binary schema version: 0.2.92

Currently the bindgen format is unstable enough that these two schema versions
must exactly match. You can accomplish this by either updating this binary or 
the wasm-bindgen dependency in the Rust project.

You should be able to update the wasm-bindgen dependency with:

    cargo update -p wasm-bindgen --precise 0.2.92

don't forget to recompile your wasm file! Alternatively, you can update the 
binary with:

    cargo install -f wasm-bindgen-cli --version 0.2.100

if this warning fails to go away though and you're not sure what to do feel free
to open an issue at https://github.com/rustwasm/wasm-bindgen/issues!

UkoeHB avatar Jan 24 '25 04:01 UkoeHB

As far as I understand this is unavoidable, wasm-bindgen doesn't have a stable API so you need to ensure that the versions match.

So far I haven't had a problem with occasionally updating both when there was a mismatch, so that seems like an acceptable situation to me.

The only thing we could do if this message leads to confusion would be to display a custom error message, mentioning the suggested resolution of

cargo install wasm-server-runner
cargo update wasm-bindgen

jakobhellermann avatar Jan 26 '25 15:01 jakobhellermann

Yep it just needs to be documented.

So far I haven't had a problem with occasionally updating both when there was a mismatch, so that seems like an acceptable situation to me.

It might be obvious to you, but the last 2 times it happened I wasted a ton of time trying to track down how to fix it.

UkoeHB avatar Jan 26 '25 19:01 UkoeHB

Ideally you could publish a new version on crates.io, so that those who install using cargo install --locked wasm-server-runner could benefit from the updated Cargo.lock...

teohhanhui avatar Mar 18 '25 14:03 teohhanhui

It might be obvious to you, but the last 2 times it happened I wasted a ton of time trying to track down how to fix it.

That's very fair. I've updated the message, it now looks like this:

Error: The rust project was linked against a different version of wasm-bindgen.
wasm-server-runner version: 0.2.92
wasm file schema version:   0.2.100

To resolve this, update the wasm-bindgen dependency and/or wasm-server-runner binary:
    cargo update -p wasm-bindgen
    cargo install -f wasm-server-runner

Ideally you could publish a new version on crates.io, so that those who install using cargo install --locked wasm-server-runner could benefit from the updated Cargo.lock...

I've published v1.0.0 now with the change above and updated crate dependencies. Although of course, this is a use case where running without --locked is useful so that you don't have to republish on every wasm-bindgen release.

jakobhellermann avatar Mar 24 '25 22:03 jakobhellermann