leptos-rs / start-axum

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

Errors when compiling starter-axum #21

Closed s1n7ax closed 1 year ago

s1n7ax commented 1 year ago

I'm new to Rust and trying to learn Leptos. I started installing cargo-leptos.

A project was generated using below

cargo leptos new --git leptos-rs/start-axum

.
├── Cargo.lock
├── Cargo.toml
├── end2end
│   ├── package.json
│   ├── package-lock.json
│   ├── playwright.config.ts
│   └── tests
│       └── example.spec.ts
├── LICENSE
├── public
│   └── favicon.ico
├── README.md
├── rust-toolchain.toml
├── src
│   ├── app.rs
│   ├── error_template.rs
│   ├── fileserv.rs
│   ├── lib.rs
│   └── main.rs
├── style
│   └── main.scss

When watching the project, I get thousands of lines of errors from the core Rust. First I tried it in NixOS 23 directly installing cargo-leptos from the package manager but I got the same issue so I created a custom docker container to check if it's a NixOS related issue. It appears not.

cargo leptos watch
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2023-09-17, rust version 1.74.0-nightly (7d9bce327 2023-09-16)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
   Compiling proc-macro2 v1.0.67
   Compiling unicode-ident v1.0.12
   Compiling version_check v0.9.4
   Compiling once_cell v1.18.0
   Compiling autocfg v1.1.0
   Compiling thiserror v1.0.48
   Compiling serde v1.0.188
   Compiling wasm-bindgen-shared v0.2.87
   Compiling cfg-if v1.0.0
   Compiling syn v1.0.109
   Compiling bumpalo v3.14.0
   Compiling log v0.4.20
   Compiling wasm-bindgen v0.2.87
   Compiling memchr v2.6.3
   Compiling itoa v1.0.9
   Compiling futures-core v0.3.28
   Compiling serde_json v1.0.107
   Compiling futures-channel v0.3.28
   Compiling libc v0.2.148
   Compiling ryu v1.0.15
   Compiling unicode-xid v0.2.4
   Compiling futures-sink v0.3.28
   Compiling futures-task v0.3.28
   Compiling smallvec v1.11.0
   Compiling pin-project-lite v0.2.13
   Compiling futures-util v0.3.28
   Compiling lazy_static v1.4.0
   Compiling ucd-trie v0.1.6
error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error[E0463]: can't find crate for `compiler_builtins`

error[E0463]: can't find crate for `core`
  --> /home/s1n7ax/.cargo/registry/src/index.crates.io-6f17d22bba15001f/itoa-1.0.9/src/lib.rs:45:5
   |
45 | use core::mem::{self, MaybeUninit};
   |     ^^^^ can't find crate
   |
   = note: the `wasm32-unknown-unknown` target may not be installed
s1n7ax commented 1 year ago

Following fixed the issue

rustup target add wasm32-unknown-unknown