Skip to content

Commit ac8171e

Browse files
authored
Merge pull request #34214 from storybookjs/fix/repro-command
CLI: Use npm info to fetch versions in repro command
2 parents adf67ad + 5c739b6 commit ac8171e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

code/lib/cli-storybook/src/sandbox.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { existsSync } from 'node:fs';
22
import { mkdir, readdir, rm } from 'node:fs/promises';
33
import { isAbsolute } from 'node:path';
44

5-
import type { PackageManagerName } from 'storybook/internal/common';
5+
import { PackageManagerName } from 'storybook/internal/common';
66
import {
77
JsPackageManagerFactory,
88
isCI,
@@ -42,10 +42,10 @@ export const sandbox = async ({
4242
let selectedConfig: Template | undefined = TEMPLATES[filterValue as TemplateKey];
4343
let templateId: Choice | null = selectedConfig ? (filterValue as TemplateKey) : null;
4444

45-
const { packageManager: pkgMgr } = options;
46-
45+
// Always use npm to fetch versions, as other package manager commands may fail when running in
46+
// non-project directories (e.g. parent sandbox directory). We just need to use npm info for this use case.
4747
const packageManager = JsPackageManagerFactory.getPackageManager({
48-
force: pkgMgr,
48+
force: PackageManagerName.NPM,
4949
});
5050
const latestVersion = (await packageManager.latestVersion('storybook'))!;
5151
const nextVersion = (await packageManager.latestVersion('storybook@next')) ?? '0.0.0';

0 commit comments

Comments
 (0)