Skip to content

Commit 57ee6e1

Browse files
Merge pull request #29152 from storybookjs/valentin/fix-package-manager-addition-to-package-json
Core: Do not add packageManager field to package.json during `storybook dev`
2 parents 57cdf15 + 0d238e2 commit 57ee6e1

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

code/core/src/common/js-package-manager/JsPackageManagerFactory.ts

+21-3
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,35 @@ export class JsPackageManagerFactory {
125125
}
126126

127127
function hasNPM(cwd?: string) {
128-
const npmVersionCommand = spawnSync('npm', ['--version'], { cwd, shell: true });
128+
const npmVersionCommand = spawnSync('npm', ['--version'], {
129+
cwd,
130+
shell: true,
131+
env: {
132+
COREPACK_ENABLE_STRICT: '0',
133+
},
134+
});
129135
return npmVersionCommand.status === 0;
130136
}
131137

132138
function hasPNPM(cwd?: string) {
133-
const pnpmVersionCommand = spawnSync('pnpm', ['--version'], { cwd, shell: true });
139+
const pnpmVersionCommand = spawnSync('pnpm', ['--version'], {
140+
cwd,
141+
shell: true,
142+
env: {
143+
COREPACK_ENABLE_STRICT: '0',
144+
},
145+
});
134146
return pnpmVersionCommand.status === 0;
135147
}
136148

137149
function getYarnVersion(cwd?: string): 1 | 2 | undefined {
138-
const yarnVersionCommand = spawnSync('yarn', ['--version'], { cwd, shell: true });
150+
const yarnVersionCommand = spawnSync('yarn', ['--version'], {
151+
cwd,
152+
shell: true,
153+
env: {
154+
COREPACK_ENABLE_STRICT: '0',
155+
},
156+
});
139157

140158
if (yarnVersionCommand.status !== 0) {
141159
return undefined;

0 commit comments

Comments
 (0)