fix(cli): change Cargo.toml version check to debug log (#14468)

This commit is contained in:
Fabian-Lars 2025-11-18 16:08:17 +01:00 committed by GitHub
parent f855caf8a3
commit 79a7d9ec01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -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.

View File

@ -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))