1

I am just getting started with Rust and Leptos, so I'm also quite new to the whole rust / cargo ecosystem.

I was following the leptos tutorial to setup a new leptos project using axum. When I tried starting the project with

cargo leptos watch

I ran into the following issue:

Error: at `/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.1.9/src/compile/front.rs:46:30`

Caused by:
    0: at `/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.1.9/src/compile/front.rs:111:10`
    1: 
       
       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.84
            this binary schema version: 0.2.86
       
       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.86
       
       don't forget to recompile your wasm file! Alternatively, you can update the 
       binary with:
       
           cargo install -f wasm-bindgen-cli --version 0.2.84
       
       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!

I tried both suggested solutions. The first one gives me

    Updating crates.io index
error: failed to select a version for the requirement `wasm-bindgen = "=0.2.84"`
candidate versions found which didn't match: 0.2.86
location searched: crates.io index
required by package `start-axum v0.1.0 (...)`
perhaps a crate was updated and forgotten to be re-vendored?

The second option gives me no errors, but it doesn't resolve the initial problem.

Anyone had this issue before?

platzhersh
  • 1,520
  • 20
  • 35
  • 1
    Do you have `wasm-bindgen = "=0.2.84"` in your own `Cargo.toml`? You need to adjust that manually. I'm pretty sure `cargo update` only updates the lockfile and so would be in conflict. – kmdreko Jun 11 '23 at 22:34
  • I did. Just changed it to `wasm-bindgen = "=0.2.86"` and now it works - I somehow thought `cargo update` would do that for me. Thanks for the quick reply the simple solution :-) – platzhersh Jun 11 '23 at 22:45
  • 1
    @platzhersh it sounds like you can add your experience as an answer! – helios Jun 14 '23 at 03:01
  • @helios you are right. Thanks, just did that. – platzhersh Jun 21 '23 at 06:05

1 Answers1

0

Just changed the was-bindgen in Cargo.toml to wasm-bindgen = "=0.2.86" and now it works - as also suggested by @kmdreko.

cargo update does not seem to force update packages, if they are defined with an exact version (=)

platzhersh
  • 1,520
  • 20
  • 35