diff --git a/code/core/src/common/js-package-manager/JsPackageManagerFactory.ts b/code/core/src/common/js-package-manager/JsPackageManagerFactory.ts index 7477a1e5f2c0..35856310d039 100644 --- a/code/core/src/common/js-package-manager/JsPackageManagerFactory.ts +++ b/code/core/src/common/js-package-manager/JsPackageManagerFactory.ts @@ -125,12 +125,24 @@ export class JsPackageManagerFactory { } function hasNPM(cwd?: string) { - const npmVersionCommand = spawnSync('npm', ['--version'], { cwd, shell: true }); + const npmVersionCommand = spawnSync('npm', ['--version'], { + cwd, + shell: true, + env: { + COREPACK_ENABLE_STRICT: '0', + }, + }); return npmVersionCommand.status === 0; } function hasPNPM(cwd?: string) { - const pnpmVersionCommand = spawnSync('pnpm', ['--version'], { cwd, shell: true }); + const pnpmVersionCommand = spawnSync('pnpm', ['--version'], { + cwd, + shell: true, + env: { + COREPACK_ENABLE_STRICT: '0', + }, + }); return pnpmVersionCommand.status === 0; }