Skip to content

Commit 0014186

Browse files
clydinKeen Yee Liau
authored andcommitted
fix(@angular/cli): silence package manager not found messages
Fixes #12939
1 parent 26245c0 commit 0014186

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

packages/angular/cli/utilities/package-manager.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,22 @@ import { existsSync } from 'fs';
1010
import { join } from 'path';
1111
import { getConfiguredPackageManager } from './config';
1212

13-
14-
export function supportsYarn(): boolean {
13+
function supports(name: string): boolean {
1514
try {
16-
execSync('yarn --version');
15+
execSync(`${name} --version`, { stdio: 'ignore' });
1716

1817
return true;
1918
} catch {
2019
return false;
2120
}
2221
}
2322

24-
export function supportsNpm(): boolean {
25-
try {
26-
execSync('npm --version');
23+
export function supportsYarn(): boolean {
24+
return supports('yarn');
25+
}
2726

28-
return true;
29-
} catch {
30-
return false;
31-
}
27+
export function supportsNpm(): boolean {
28+
return supports('npm');
3229
}
3330

3431
export function getPackageManager(root: string): string {

0 commit comments

Comments
 (0)