leptos-rs / start-axum

Starter template for use with the Leptos web framework and Axum.
The Unlicense
141 stars 26 forks source link

fresh install won't run #48

Closed dominikwilkowski closed 2 months ago

dominikwilkowski commented 2 months ago

If I install a completely fresh folder via cargo leptos new --git leptos-rs/start-axum I get an error for the wasm-bindgen = "=0.2.93" dependency:

~/Desktop λ cargo leptos new --git leptos-rs/start-axum
🤷   Project Name: codon
🔧   Destination: /Users/dominik/Desktop/codon ...
🔧   project-name: codon ...
🔧   Generating template ...
✔ 🤷   Use nightly features? · Yes
🔧   Moving generated files into: `/Users/dominik/Desktop/codon`...
🔧   Initializing a fresh Git repository
✨   Done! New project created /Users/dominik/Desktop/codon
~/Desktop λ cd con
cd: no such file or directory: con
~/Desktop λ cd codon
~/Desktop/codon λ cargo leptos watch
   Compiling [..]
   Compiling leptos_router v0.6.14
   Compiling codon v0.1.0 (/Users/dominik/Desktop/codon)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 25.84s
       Cargo finished cargo build --package=codon --lib --target-dir=/Users/dominik/Desktop/codon/target/front --target=wasm32-unknown-unknown --no-default-features --features=hydrate
       Front compiling WASM
Error: at `/Users/dominik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.2.17/src/compile/front.rs:47:30`

Caused by:
    0: at `/Users/dominik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.2.17/src/compile/front.rs:122: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.93
            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.93

       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!

If I then downgrade that dependency I get a bunch of different errors:

λ cargo leptos watch
   Compiling [..]
   Compiling server_fn v0.6.14
error[E0599]: no method named `set_headers` found for struct `RequestInit` in the current scope
   --> /Users/dominik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/server_fn-0.6.14/src/request/browser.rs:196:10
    |
196 |     init.set_headers(&headers);
    |          ^^^^^^^^^^^
    |
help: there is a method `headers` with a similar name
    |
196 |     init.headers(&headers);
    |          ~~~~~~~

error[E0599]: no method named `set_method` found for struct `RequestInit` in the current scope
   --> /Users/dominik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/server_fn-0.6.14/src/request/browser.rs:197:10
    |
197 |     init.set_method("POST");
    |          ^^^^^^^^^^
    |
help: there is a method `method` with a similar name
    |
197 |     init.method("POST");
    |          ~~~~~~

error[E0599]: no method named `set_body` found for struct `RequestInit` in the current scope
   --> /Users/dominik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/server_fn-0.6.14/src/request/browser.rs:198:10
    |
198 |     init.set_body(&stream);
    |          ^^^^^^^^
    |
help: there is a method `body` with a similar name
    |
198 |     init.body(&stream);
    |          ~~~~

For more information about this error, try `rustc --explain E0599`.
error: could not compile `server_fn` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
      Notify watching paths public, src, style
^C      Leptos ctrl-c received

I'm on latest nightly on latest macos on M1 arm64.

   stable-aarch64-apple-darwin unchanged - rustc 1.80.1 (3f5fd8dd4 2024-08-06)
  nightly-aarch64-apple-darwin unchanged - rustc 1.82.0-nightly (6de928dce 2024-08-18)
gbj commented 2 months ago

I can't reproduce this issue with the latest version of cargo-leptos: it is likely you need to update it. wasm-bindgen-cli needs to update on every patch release, so we often need to combine an update to cargo-leptos with an update to the wasm-bindgen version.

Ping me if updating doesn't fix the issue.

dominikwilkowski commented 2 months ago

Can confirm that after installing the latest cargo-leptos the problem went away (though I had to blow up the newly created folder and re-create it).

Thank you

λ cargo leptos -V
cargo-leptos 0.2.17
λ cargo install cargo-leptos
[...]
λ cargo leptos -V
cargo-leptos 0.2.19
roman-raizen commented 1 month ago

having same issue

$ cargo leptos -V
cargo-leptos 0.2.20
roman-raizen commented 1 month ago

Actually not the same but rather this part:

λ cargo leptos watch
   Compiling [..]
   Compiling server_fn v0.6.14
error[E0599]: no method named `set_headers` found for struct `RequestInit` in the current scope
   --> /Users/dominik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/server_fn-0.6.14/src/request/browser.rs:196:10
    |
196 |     init.set_headers(&headers);
    |          ^^^^^^^^^^^
    |
help: there is a method `headers` with a similar name
    |
196 |     init.headers(&headers);
    |          ~~~~~~~

error[E0599]: no method named `set_method` found for struct `RequestInit` in the current scope
   --> /Users/dominik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/server_fn-0.6.14/src/request/browser.rs:197:10
    |
197 |     init.set_method("POST");
    |          ^^^^^^^^^^
    |
help: there is a method `method` with a similar name
    |
197 |     init.method("POST");
    |          ~~~~~~

error[E0599]: no method named `set_body` found for struct `RequestInit` in the current scope
   --> /Users/dominik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/server_fn-0.6.14/src/request/browser.rs:198:10
    |
198 |     init.set_body(&stream);
    |          ^^^^^^^^
    |
help: there is a method `body` with a similar name
    |
198 |     init.body(&stream);
    |          ~~~~

For more information about this error, try `rustc --explain E0599`.
error: could not compile `server_fn` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
      Notify watching paths public, src, style
^C      Leptos ctrl-c received