Improve upgrade command installation method detection robustness#960
Merged
Improve upgrade command installation method detection robustness#960
Conversation
The upgrade command was failing to detect installation method for users who installed via pnpm, yarn, or bun, showing "Could not detect installation method" errors. ## Changes Made - **Added support for additional package managers**: Extended detection to include pnpm, yarn, and bun alongside existing npm, Homebrew, and Cargo support - **Implemented install-time marker system**: Modified `postinstall.js` to write a `.install-method` marker file during installation, providing reliable detection that doesn't depend on fragile path heuristics - **Enhanced path-based fallback detection**: Improved executable path analysis to better identify installation locations for all supported package managers - **Added command probing**: Implemented fallback checks that query package managers directly to verify global installations The detection now follows this robust hierarchy: 1. Read install-time marker file (most reliable) 2. Analyze executable path patterns 3. Probe package managers via subprocess calls This ensures users can successfully upgrade regardless of their chosen package manager. Fixes #954
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Prevent bin/.install-method marker file from being accidentally committed during development - Add comment clarifying that yarn global upgrade path only works with Yarn Classic (v1), not Yarn Berry (v2+)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The upgrade command was failing to detect installation method for users who installed via pnpm, yarn, or bun, showing "Could not detect installation method" errors.
Changes Made
postinstall.jsto write a.install-methodmarker file during installation, providing reliable detection that doesn't depend on fragile path heuristicsThe detection now follows this robust hierarchy:
This ensures users can successfully upgrade regardless of their chosen package manager.
Fixes #954