From 79a7d9ec01be1a371b8e923848140fea75e9caed Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Tue, 18 Nov 2025 16:08:17 +0100 Subject: [PATCH] fix(cli): change Cargo.toml version check to debug log (#14468) --- .changes/version-req-error.md | 5 +++++ crates/tauri-cli/src/info/plugins.rs | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changes/version-req-error.md diff --git a/.changes/version-req-error.md b/.changes/version-req-error.md new file mode 100644 index 000000000..523d6f1c8 --- /dev/null +++ b/.changes/version-req-error.md @@ -0,0 +1,5 @@ +--- +tauri-cli: patch:bug +--- + +Fixed an issue that caused the cli to print errors like `Error Failed to parse version 2 for crate tauri` when there was no `Cargo.lock` file present yet. This will still be logged in `--verbose` mode. diff --git a/crates/tauri-cli/src/info/plugins.rs b/crates/tauri-cli/src/info/plugins.rs index 989abe356..a5080caf1 100644 --- a/crates/tauri-cli/src/info/plugins.rs +++ b/crates/tauri-cli/src/info/plugins.rs @@ -72,7 +72,10 @@ pub fn installed_tauri_packages( crate_version(tauri_dir, manifest.as_ref(), lock.as_ref(), crate_name).version?; let crate_version = semver::Version::parse(&crate_version) .inspect_err(|_| { - log::error!("Failed to parse version `{crate_version}` for crate `{crate_name}`"); + // On first run there's no lockfile yet so we get the version requirement from Cargo.toml. + // In our templates that's `2` which is not a valid semver version but a version requirement. + // log::error confused users so we use log::debug to still be able to see this error if needed. + log::debug!("Failed to parse version `{crate_version}` for crate `{crate_name}`"); }) .ok()?; Some((crate_name.clone(), crate_version))