Skip to content

Commit e778d21

Browse files
committed
fix(installer): reinstall when current version directory is incomplete
The same-version check now verifies that the binary (current/bin/vp.exe) actually exists, not just that the current symlink points at the target version. If the version directory is corrupted or partially deleted, the installer performs a full reinstall instead of skipping to the best-effort repair steps which cannot restore missing core files.
1 parent e8054c9 commit e778d21

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/vite_installer/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ async fn do_install(
127127
let target_version =
128128
registry::resolve_version_string(version_or_tag, opts.registry.as_deref()).await?;
129129

130-
let same_version = current_version.as_deref() == Some(target_version.as_str());
130+
// Same version only if the binary is intact — a corrupted install needs a full reinstall
131+
let same_version = current_version.as_deref() == Some(target_version.as_str())
132+
&& tokio::fs::try_exists(install_dir.join("current").join("bin").join(VP_BINARY_NAME))
133+
.await
134+
.unwrap_or(false);
131135

132136
if same_version {
133137
if !opts.quiet {

0 commit comments

Comments
 (0)