https://linen.dev logo
Error with updating shuttle and project
# help
r
I am unable to use shuttle with the project
b
Can you share the link to the repo?
r
I have not uploaded to the repo
b
Gotchu. Can you tell me what exactly you are trying to achieve? Looking at that screenshot, you are running the
cargo shuttle project new
command inside of a folder which doesn't have a cargo/shuttle project initialized.
r
wait , now
Copy code
cargo shuttle project rm
is happening
Now, I am trying to run this command and I think it's working 🙂
no, there's an error
b
Not sure I can help here without seeing what the code inside that folder is :/ I'm also looping @kind-area-3810 in real quick.
r
I only have lib.rs
Copy code
use axum::{routing::get, Router};
use sync_wrapper::SyncWrapper;

async fn hello_world() -> &'static str {
    "Hello, world!"
}

#[shuttle_service::main]
async fn axum() -> shuttle_service::ShuttleAxum {
    let router = Router::new().route("/hello", get(hello_world));
    let sync_wrapper = SyncWrapper::new(router);

    Ok(sync_wrapper)
}
with this default boilerplate code
Copy code
[package]
name = "some-try"
version = "0.1.0"
edition = "2021"
publish = false

[lib]

[dependencies]
shuttle-service = { version = "0.10.0", features = ["web-axum"] }
axum = "0.6.7"
sync_wrapper = "0.1.2"
and this is cargo.toml
k
What is your
cargo shuttle --version
?
r
thanks 🙂
cargo-shuttle 0.9.0
k
This error is because you need to be inside a shuttle project directory, so if you do init you then need to move into that directory before running commands. The error message could be clearer though 😄
r
thanks 🙂
k
Upgrading to 0.10 should fix it,
cargo install cargo-shuttle
r
how to uninstall this first?
I am really sorry, I am totally new 😅
I just started shuttle and rust some days ago
k
No worries, welcome! You can just run that command and it will re-install the latest version
r
thanks a lot 🙂
@kind-area-3810
Copy code
error: couldn't read \\?\C:\Users\Paul\Desktop\Main\RUST\learnings\some-try\target\debug\build\rustversion-0287506047303358\out/version.expr: The filename, directory name, or volume label syntax is incorrect. (os error 123)
   --> C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\rustversion-1.0.11\src\lib.rs:185:30
    |
185 | const RUSTVERSION: Version = include!(concat!(env!("OUT_DIR"), "/version.expr"));
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)


error: aborting due to previous error


error: could not compile `rustversion` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Error: 1 job failed
I am sorry If I was not supposed to ping you
I am getting this error
k
This is a bug we have on windows, there is a work-around here:
r
thanks 🙂
again sorry to disturb
this error is coming now
k
Shuttle projects need to use tokio version 1.22 currently, so your app needs to use the same version. If you're curious why, here is the PR that set it:
r
Thanks 🙂
It still shows RUST_STACKTRACE error
k
What does the error say now?
r
Copy code
error[E0433]: failed to resolve: could not find `main` in `tokio`
  --> src\lib.rs:56:10
   |
56 | #[tokio::main]
   |          ^^^^ could not find `main` in `tokio`


error: aborting due to previous error
a
it'd be helpful if you had a repo or code snippet so we could debug this
are you trying to use the
tokio::main
macro?
r
hello, I am really sorry to message late, I was out of station
yes I am using tokio::main macro
a
It might not be a good idea to use that if you're already using the shuttle service macro - typically
#[tokio::main]
is used on the entry point function (main) but because you're already using
#[shuttle_service::main]
you don't need to run the tokio macro
27 Views