Skip to content

fix: package manager detection in non interactive environments #503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tall-moons-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

fix: package manager detection in non interactive environments
4 changes: 4 additions & 0 deletions packages/cli/utils/package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export async function packageManagerPrompt(cwd: string): Promise<AgentName | und
const detected = await detect({ cwd });
const agent = detected?.name ?? getUserAgent();

// If we are in a non interactive environment just go with the detected package manager.
// There is no need to prompt in that case.
if (!process.stdout.isTTY) return agent;

const pm = await p.select({
message: 'Which package manager do you want to install dependencies with?',
options: agentOptions,
Expand Down