Skip to content

Commit 79a7d9e

Browse files
authored
fix(cli): change Cargo.toml version check to debug log (#14468)
1 parent f855caf commit 79a7d9e

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

.changes/version-req-error.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
tauri-cli: patch:bug
3+
---
4+
5+
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.

crates/tauri-cli/src/info/plugins.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ pub fn installed_tauri_packages(
7272
crate_version(tauri_dir, manifest.as_ref(), lock.as_ref(), crate_name).version?;
7373
let crate_version = semver::Version::parse(&crate_version)
7474
.inspect_err(|_| {
75-
log::error!("Failed to parse version `{crate_version}` for crate `{crate_name}`");
75+
// On first run there's no lockfile yet so we get the version requirement from Cargo.toml.
76+
// In our templates that's `2` which is not a valid semver version but a version requirement.
77+
// log::error confused users so we use log::debug to still be able to see this error if needed.
78+
log::debug!("Failed to parse version `{crate_version}` for crate `{crate_name}`");
7679
})
7780
.ok()?;
7881
Some((crate_name.clone(), crate_version))

0 commit comments

Comments
 (0)