Skip to content

Commit ec08c24

Browse files
authored
fix(upgrade): detect npm install method from node_modules path (#723)
## Summary - Add `detectPackageManagerFromPath()` — a fast path-based check that detects npm/pnpm installation by examining `process.argv[1]` for a `node_modules` segment - Wire it into the detection cascade after Homebrew (`/Cellar/`) and before the DB lookup, mirroring the same authoritative-override pattern - Persists the detected method to SQLite so subsequent runs skip even this cheap check ## Problem When the CLI is installed via npm and run on Windows (especially via NVM/Laravel Herd), spawning `npm`, `pnpm`, `bun`, `yarn` to detect the install method fails with ENOENT because `.cmd` files aren't found by `spawn()` without `shell: true`. This left the method as `"unknown"`, blocking `sentry cli upgrade` entirely — even though the CLI was clearly running from a `node_modules` directory. ## Approach Rather than fixing the Windows spawn issue (which would still be slow and fragile), add a fast path check that examines the script path for a `node_modules` segment — the same pattern used by the Homebrew `/Cellar/` check. Cross-platform (splits on both `/` and `\`), handles Windows 8.3 short paths, and distinguishes pnpm via its `.pnpm` directory. Fixes CLI-Y1
1 parent 29b8eba commit ec08c24

3 files changed

Lines changed: 272 additions & 53 deletions

File tree

0 commit comments

Comments
 (0)