Description
When a globally installed package is not present, vp uninstall -g <pkg> exits with a non-zero status and prints an error. This breaks common shell patterns such as:
vp uninstall -g corepack && vp install -g <pkg>
The && chain stops after the uninstall step, so the subsequent install never runs.
npm uninstall -g does not exhibit this behavior — uninstalling a package that is not installed succeeds with exit code 0, allowing idempotent uninstall-then-install workflows.
Steps to reproduce
-
Ensure corepack is not listed in global packages:
-
Run uninstall:
Actual: exits with code 1 and prints:
Failed to uninstall corepack: Package corepack is not installed
-
Compare with npm:
npm uninstall -g corepack
echo $?
Actual: exits with code 0 (no error).
-
Chained command fails with vp but works with npm:
# Fails — second command never runs
vp uninstall -g corepack && vp install -g typescript
# Works — install runs even if corepack was not installed
npm uninstall -g corepack && npm install -g typescript
Expected behavior
vp uninstall -g <pkg> should succeed (exit 0) when the package is not installed, consistent with npm. Uninstalling something that is already absent should be a no-op, not an error.
This is especially relevant for packages like corepack that may be managed implicitly by Vite+ (shim / auto-install on Node 25+) and therefore may not appear in vp list -g, yet users still want to run vp uninstall -g corepack defensively before installing another global package.
Environment
vp version: v0.2.7
- OS: Linux (Fedora)
- Node.js: v24.19.0 (via Vite+)
Description
When a globally installed package is not present,
vp uninstall -g <pkg>exits with a non-zero status and prints an error. This breaks common shell patterns such as:The
&&chain stops after the uninstall step, so the subsequent install never runs.npm uninstall -gdoes not exhibit this behavior — uninstalling a package that is not installed succeeds with exit code 0, allowing idempotent uninstall-then-install workflows.Steps to reproduce
Ensure
corepackis not listed in global packages:Run uninstall:
Actual: exits with code 1 and prints:
Compare with npm:
Actual: exits with code 0 (no error).
Chained command fails with
vpbut works withnpm:Expected behavior
vp uninstall -g <pkg>should succeed (exit 0) when the package is not installed, consistent with npm. Uninstalling something that is already absent should be a no-op, not an error.This is especially relevant for packages like
corepackthat may be managed implicitly by Vite+ (shim / auto-install on Node 25+) and therefore may not appear invp list -g, yet users still want to runvp uninstall -g corepackdefensively before installing another global package.Environment
vpversion: v0.2.7