dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Nightly issue: dioxus-cli fails to build due to new Cargo.lock (version 4) format

Open alex-tianhuang opened this issue 1 year ago • 5 comments

Problem

When starting a new dioxus project using dioxus-cli compiled on nightly, the build fails as the Cargo.lock version (=4) is newer than expected. Additionally, using dioxus-cli compiled from stable with any project that has this new Cargo.lock version (I'm trying to use it for a project which requires nightly)

Steps To Reproduce

  1. Install dioxus v0.5.7 using cargo install (nightly-aarch64-apple-darwin rustc)
  2. Make a project using dx new + dx serve OR
  3. Install dioxus v0.5.7 using cargo install (stable rustc)
  4. Run dx serve on an existing project which uses Cargo.lock version 4

Expected behavior

Dioxus serves the webpage

Screenshots Here are all the steps needed to reproduce the bug: image Here is the final failing build command with some traceback: image Here is a Cargo.lock generated by dx new (nightly compiled dioxus-cli): image

Environment:

  • Dioxus version: 0.5.7
  • Rust version: 1.83.0-nightly
  • OS info: MacOS

alex-tianhuang avatar Oct 03 '24 20:10 alex-tianhuang

Same problem here.

Environment:

  • Dioxus version: 0.5.6
  • Rust version: 1.83.0-nightly
  • OS info: Windows 10

OlePaycxEu avatar Oct 09 '24 14:10 OlePaycxEu

Same problem here.

Environment:

  • Dioxus 0.5
dx serve --platform fullstack
  👑 Build done.
| 💼 Waiting to start building the project...                                                 thread 'main' panicked at /home/siki/.cargo/registry/src/index.crates.io-6f17d22bba15001f/manganis-cli-support-0.2.4/src/manifest.rs:51:51:
called `Result::unwrap()` on an `Err` value: Parse("parse error: invalid Cargo.lock format version: `4`\n")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

sikioforie avatar Oct 12 '24 05:10 sikioforie

Same boat here...

Dioxus 0.5.6 Rust 1.84.0-nightly OS: Win11

thread 'main' panicked at C:\Users\OMISTAJA.cargo\registry\src\index.crates.io-6f17d22bba15001f\manganis-cli-support-0.2.4\src\manifest.rs:51:51: called Result::unwrap() on an Err value: Parse("parse error: invalid Cargo.lock format version: 4\n") stack backtrace: 0: 0x7ff6e62a0cb1 - git_index_checksum 1: 0x7ff6e62ca77a - git_index_checksum 2: 0x7ff6e62998a7 - git_index_checksum 3: 0x7ff6e62a0af5 - git_index_checksum 4: 0x7ff6e62a2c57 - git_index_checksum 5: 0x7ff6e62a2a37 - git_index_checksum 6: 0x7ff6e62a32e3 - git_index_checksum 7: 0x7ff6e62a3169 - git_index_checksum 8: 0x7ff6e62a176f - git_index_checksum 9: 0x7ff6e62a2d6e - git_index_checksum 10: 0x7ff6e6528e71 - git_midx_writer_new 11: 0x7ff6e65292a0 - git_midx_writer_new 12: 0x7ff6e4dd2c46 - git_index_checksum 13: 0x7ff6e3f40e82 - git_filter_source_repo 14: 0x7ff6e3e9159a - git_filter_source_repo 15: 0x7ff6e3e1c4ff - git_filter_source_repo 16: 0x7ff6e3d5df6e - git_filter_source_repo 17: 0x7ff6e3ce261b - git_filter_source_repo 18: 0x7ff6e3dc06da - git_filter_source_repo 19: 0x7ff6e3cc36f2 - git_filter_source_repo 20: 0x7ff6e3c58a06 - 21: 0x7ff6e3d75afa - git_filter_source_repo 22: 0x7ff6e628f64c - git_index_checksum 23: 0x7ff6e3cc387c - git_filter_source_repo 24: 0x7ff6e647997c - git_midx_writer_new 25: 0x7ffffd5c257d - BaseThreadInitThunk 26: 0x7ffffed2af08 - RtlUserThreadStart

msukanen avatar Oct 15 '24 02:10 msukanen

I'm having the same issue. I got the build to work by manually changing the Cargo.lock version to 3.

  • rustc: 1.83.0-nightly (1bc403daa 2024-10-11)
  • dioxus 0.5.7
  • Win 11

Running BeforeDevCommand (dx serve --port 1420) Warn Waiting for your frontend dev server to start on http://localhost:1420/... 👑 Build done.
thread 'main' panicked at C:\Users\mine.cargo\registry\src\index.crates.io-6f17d22bba15001f\manganis-cli-support-0.2.4\src\manifest.rs:51:51: called Result::unwrap() on an Err value: Parse("parse error: invalid Cargo.lock format version: 4\n") note: run with RUST_BACKTRACE=1 environment variable to display a backtrace Error The "beforeDevCommand" terminated with a non-zero status code.

luis-prates avatar Oct 15 '24 13:10 luis-prates

I did a little digging and this issue might be fixed in the 0.6 alpha CLI. If you can't use the 0.6 alpha version of Dioxus due to bugs or other reasons, you can see if what @luis-prates said works, and manually set the lock version to 3.

cargo install [email protected] and dioxus = { version = "0.6.0-alpha.4", features = ["myplatformhere"] }

DogeDark avatar Oct 20 '24 18:10 DogeDark

some

thread 'main' panicked at /Users/peguo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/manganis-cli-support-0.2.4/src/manifest.rs:51:51: called Result::unwrap() on an Err value: Parse("parse error: invalid Cargo.lock format version: 4\n") note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

casperkwok avatar Oct 30 '24 13:10 casperkwok

Today, I updated Rust to the new release ver. 1.83 and now I'm facing this issue for the first time on this sample:

❯ ./run_dev.sh 
  👑 Build done.                                                                                                                                                                   thread 'main' panicked at /home/dxps/.cargo/registry/src/index.crates.io-6f17d22bba15001f/manganis-cli-support-0.2.4/src/manifest.rs:51:51:
called `Result::unwrap()` on an `Err` value: Parse("parse error: invalid Cargo.lock format version: `4`\n")
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: <manganis_common::manifest::AssetManifest as manganis_cli_support::manifest::AssetManifestExt>::load_from_path
   4: dioxus_cli::assets::asset_manifest
   5: dioxus_cli::builder::build_web
   6: dioxus_cli::server::web::serve::{{closure}}
   7: dioxus_cli::cli::serve::Serve::serve::{{closure}}
   8: dx::main::{{closure}}
   9: tokio::runtime::park::CachedParkThread::block_on
  10: tokio::runtime::runtime::Runtime::block_on
  11: dx::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
❯ 

Did the cleanup (removed Cargo.lock, ran dx clean and cargo clean), same result.


Downgraded to Rust 1.82, did the cleanup again and all runs again (Cargo.lock being generated with version 3).

dxps avatar Nov 29 '24 14:11 dxps

This is fixed in the 0.6.0-alpha. We no longer read the Cargo.lock file at all. Instead we look for assets in the link section of the binary cargo produces

ealmloff avatar Dec 02 '24 16:12 ealmloff

This is fixed in the 0.6.0-alpha. We no longer read the Cargo.lock file at all. Instead we look for assets in the link section of the binary cargo produces

Doesn't seem fixed in that version, nor the RC0 version. And, using the stable channel for Rust(up) doesn't suffice. One has to downgrade to 1.82 to get back to lock version 3.

davber avatar Dec 04 '24 19:12 davber

I recently came across the issue mentioned by @GTime . The reason for this is that the latest Rust toolchain, 1.85, is incompatible with Dioxus 0.5.6.

One way to resolve this is by pinning the Rust toolchain to version 1.80 and downgrading the crates used in your project.

In case it helps, I've fixed similar issues in https://github.com/opensass/opensass/pull/23.

wiseaidev avatar Apr 01 '25 23:04 wiseaidev