fix(cli): show errors when vp install fails and bypass npm & pnpm minimum release age#834
fix(cli): show errors when vp install fails and bypass npm & pnpm minimum release age#834fengmk2 merged 5 commits intovoidzero-dev:mainfrom
Conversation
✅ Deploy Preview for viteplus-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@kazupon Can install.ps1 be considered for a fix as well? I understand that there will be a similar issue under Windows? |
|
@fengmk2 And npm too. |
There was a problem hiding this comment.
Pull request overview
Improves the Vite+ installer UX by preventing silent dependency-install failures and by isolating installs from user/global package-manager settings that can block newly published packages.
Changes:
- Create a per-version
.npmrcto bypass minimum release age constraints (minimum-release-age=0/min-release-age=0). - Stop using
--silentforvp installso npm/pnpm errors are visible. - Add explicit failure handling for dependency installation (bash: custom error message; PowerShell:
$LASTEXITCODEcheck).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/cli/install.sh | Writes a local .npmrc and makes dependency-install failures visible/handled. |
| packages/cli/install.ps1 | Writes a local .npmrc and removes silent install, adding explicit exit-code handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for the review! |
fengmk2
left a comment
There was a problem hiding this comment.
Great job! Thanks helping us to improve this install DX!
## Summary related issues and PRs - #1260 - #1272 - #833 - #834 This updates the release-age handling for the Vite+ global install/upgrade path so we no longer silently bypass package manager protections. Users who configure pnpm `minimumReleaseAge` are explicitly trying to reduce supply-chain risk from newly published compromised packages. Instead of always writing `minimum-release-age=0`, Vite+ now first runs the wrapper install normally. If pnpm blocks the install with a release-age error, Vite+ only writes the local override and retries after an interactive, default-No confirmation. The same behavior is applied to the standalone install scripts, including `install.ps1` and `install.sh`. ## Changes - Remove unconditional `minimum-release-age=0` override from `vp upgrade` and standalone installers. - Detect pnpm release-age failures from `ERR_PNPM_NO_MATURE_MATCHING_VERSION`, `minimumReleaseAge` messages, and guarded `ERR_PNPM_NO_MATCHING_VERSION` cases. - Prompt users with a default-No warning before disabling release-age protection for this Vite+ install only. - Keep non-interactive environments blocked instead of adding a bypass flag or env var. - Preserve `install.log` / `upgrade.log` visibility for failure diagnosis. - Avoid passing `--silent` to the inner captured `vp install`, because pnpm suppresses the release-age error body in silent mode. - Add comments with pnpm source references explaining the release-age detection signals.
Summary
resolve #833
--silentfromvp installininstall.shso that pnpm/npm errors are visible to the user instead of being silently swallowed.npmrcwithminimum-release-age=0to the version directory to isolate the installer from the user's global pnpm configuration (e.g.minimumReleaseAgeblocking recently-published packages)Previously, when
vp install --silentfailed (for any reason),set -ewould abortinstall.shwith no error output, leaving~/.vite-plus/in a partial state: nonode_modules, nobin/symlink, noenvfile, and no PATH configuration.