Skip to content

Commit 80ac6fc

Browse files
committed
fix(@angular/cli): provide actionable error when project cannot be determined
When the workspace has multiple projects and we the project to use cannot be determined from the current working directory, we now issue an actionable error message. Closes #23291
1 parent f6f3782 commit 80ac6fc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,15 @@ export abstract class ArchitectCommandModule
5757
.strict();
5858

5959
if (!project) {
60-
return localYargs;
60+
if (getYargsCompletions || help) {
61+
// Don't issue an error when using help or completion.
62+
return localYargs;
63+
}
64+
65+
throw new CommandModuleError(
66+
'Cannot determine project for command. ' +
67+
'Pass the project name as a command line argument or change the current working directory to a project directory.',
68+
);
6169
}
6270

6371
const target = this.getArchitectTarget();

0 commit comments

Comments
 (0)