Skip to content
7 changes: 4 additions & 3 deletions crates/vite_error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub enum Error {
#[error(transparent)]
Io(#[from] std::io::Error),

#[error("IO error: {err} at {path:?}")]
#[error("IO error: {err} at {}", .path.as_path().display())]
IoWithPath { err: std::io::Error, path: Arc<AbsolutePath> },

#[error(transparent)]
Expand Down Expand Up @@ -66,7 +66,7 @@ pub enum Error {
#[error("Resolve universal vite config failed")]
ResolveUniversalViteConfigFailed { status: Str, reason: Str },

#[error("The path ({path:?}) is not a valid relative path because: {reason}")]
#[error("The path ({}) is not a valid relative path because: {reason}", .path.display())]
InvalidRelativePath { path: Box<Path>, reason: FromPathError },

#[error("Unsupported package manager: {0}")]
Expand All @@ -79,7 +79,8 @@ pub enum Error {
UnrecognizedPackageManager,

#[error(
"Package manager {name}@{version} in {package_json_path:?} is invalid, expected format: 'package-manager-name@major.minor.patch'"
"Package manager {name}@{version} in {} is invalid, expected format: 'package-manager-name@major.minor.patch'",
.package_json_path.as_path().display()
)]
PackageManagerVersionInvalid { name: Str, version: Str, package_json_path: AbsolutePathBuf },

Expand Down
4 changes: 1 addition & 3 deletions crates/vite_global_cli/src/commands/global/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,7 @@ async fn install_one(
}
let _ = std::io::stderr().write_all(&output.stderr);
cleanup_failed_install(&install_dir).await?;
return Err(Error::Other(
format!("npm install failed with exit code: {:?}", output.status.code()).into(),
));
return Err(Error::Other(format!("npm install failed with {}", output.status).into()));
}

let node_modules_dir = get_node_modules_dir(&install_dir, package_name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ npm error A complete log of this run can be found in: <homedir>/.npm/_logs/<time
✓ Installed install-fail-local-package <semver>
Bins: install-fail-local-package

error: Failed to install voidzero-nonexistent-pkg-xyz-23456: npm install failed with exit code: Some(1)
error: Failed to install voidzero-nonexistent-pkg-xyz-23456: npm install failed with exit status: 1

> install-fail-local-package
The package is installed successfully
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm error A complete log of this run can be found in: <homedir>/.npm/_logs/<timestamp>-debug.log
error: Failed to install voidzero-nonexistent-pkg-xyz-12345: npm install failed with exit code: Some(1)
error: Failed to install voidzero-nonexistent-pkg-xyz-12345: npm install failed with exit status: 1
Loading