Skip to content

Commit f1dbdb9

Browse files
dgp1130clydin
authored andcommitted
fix(@angular/cli): correctly print package manager name when an install is needed
This was printing "Try installing with '[object Object] install'".
1 parent b9a822e commit f1dbdb9

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

packages/angular/cli/src/command-builder/architect-base-command-module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export abstract class ArchitectBaseCommandModule<T extends object>
151151
}
152152

153153
this.context.logger.warn(
154-
`Node packages may not be installed. Try installing with '${this.context.packageManager} install'.`,
154+
`Node packages may not be installed. Try installing with '${this.context.packageManager.name} install'.`,
155155
);
156156
}
157157

tests/legacy-cli/e2e/tests/commands/builder-not-found.ts

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { moveFile } from '../../utils/fs';
2-
import { installPackage, uninstallPackage } from '../../utils/packages';
2+
import { getActivePackageManager, installPackage, uninstallPackage } from '../../utils/packages';
33
import { execAndWaitForOutputToMatch, ng } from '../../utils/process';
44
import { expectToFail } from '../../utils/utils';
55

@@ -14,7 +14,13 @@ export default async function () {
1414
/Could not find the '@angular-devkit\/build-angular:browser' builder's node package\./,
1515
);
1616
await expectToFail(() =>
17-
execAndWaitForOutputToMatch('ng', ['build'], /Node packages may not be installed\./),
17+
execAndWaitForOutputToMatch(
18+
'ng',
19+
['build'],
20+
new RegExp(
21+
`Node packages may not be installed\. Try installing with '${getActivePackageManager()} install'\.`,
22+
),
23+
),
1824
);
1925

2026
await moveFile('node_modules', 'temp_node_modules');
@@ -25,7 +31,13 @@ export default async function () {
2531
['build'],
2632
/Could not find the '@angular-devkit\/build-angular:browser' builder's node package\./,
2733
);
28-
await execAndWaitForOutputToMatch('ng', ['build'], /Node packages may not be installed\./);
34+
await execAndWaitForOutputToMatch(
35+
'ng',
36+
['build'],
37+
new RegExp(
38+
`Node packages may not be installed\. Try installing with '${getActivePackageManager()} install'\.`,
39+
),
40+
);
2941
} finally {
3042
await moveFile('temp_node_modules', 'node_modules');
3143
await installPackage('@angular-devkit/build-angular');

0 commit comments

Comments
 (0)