Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for project-specific ng commands outside a project #23481

Closed
dgp1130 opened this issue Jun 30, 2022 · 1 comment · Fixed by #23484
Closed

Improve error message for project-specific ng commands outside a project #23481

dgp1130 opened this issue Jun 30, 2022 · 1 comment · Fixed by #23484
Assignees
Labels
2022Q3 Fixit Candidates for the Q3 2022 fix-it area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity2: inconvenient type: bug/fix

Comments

@dgp1130
Copy link
Collaborator

dgp1130 commented Jun 30, 2022

Spin off from #23470.

Project-specific Angular CLI commands don't currently give a great error message when run in a workspace but outside a project. I forget the exact text but something along the lines of "No project available". We should improve this to clarify what we mean by project and ideally list out available projects in the workspace. Something like:

$ ng serve
This is a monorepository workspace and there are many projects you can serve. Run `ng serve <project>` to serve a specific application. Available projects are:
* my-app
* my-lib
* my-other-lib

In really big workspaces we might want to limit this list so we don't explode the console. Maybe limit to 5 or 10 projects with a suggestion to look at angular.json for more.

@dgp1130 dgp1130 added area: @angular/cli 2022Q3 Fixit Candidates for the Q3 2022 fix-it labels Jun 30, 2022
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity2: inconvenient and removed action: merge The PR is ready for merge by the caretaker labels Jun 30, 2022
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jul 1, 2022
…ands when run outside of a project

With this change we improve the error message when a project for command cannot be determined

```
Error: Cannot determine project for command.
This is a multi-project workspace and more than one project supports this command. Run "ng build [project]" to execute the command for a specific project or change the current working directory to a project directory.

Available projects are:
- project-name-0
- project-name-1
- project-name-2
- project-name-3
- project-name-4
- project-name-5
- project-name-6
- project-name-7
- project-name-8
- project-name-9
...
```

Closes angular#23481
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jul 1, 2022
…ands when run outside of a project

With this change we improve the error message when a project for command cannot be determined

```
Error: Cannot determine project for command.
This is a multi-project workspace and more than one project supports this command. Run "ng build [project]" to execute the command for a specific project or change the current working directory to a project directory.

Available projects are:
- project-name-0
- project-name-1
- project-name-2
- project-name-3
- project-name-4
- project-name-5
- project-name-6
- project-name-7
- project-name-8
- project-name-9
...
```

Closes angular#23481
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jul 1, 2022
…ands when run outside of a project

With this change we improve the error message when a project for command cannot be determined

```
Error: Cannot determine project for command.
This is a multi-project workspace and more than one project supports this command. Run "ng build [project]" to execute the command for a specific project or change the current working directory to a project directory.

Available projects are:
- project-name-0
- project-name-1
- project-name-2
- project-name-3
- project-name-4
- project-name-5
- project-name-6
- project-name-7
- project-name-8
- project-name-9
```

Closes angular#23481
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jul 1, 2022
…ands when run outside of a project

With this change we improve the error message when a project for command cannot be determined

```
Error: Cannot determine project for command.
This is a multi-project workspace and more than one project supports this command. Run "ng build [project]" to execute the command for a specific project or change the current working directory to a project directory.

Available projects are:
- project-name-0
- project-name-1
- project-name-2
- project-name-3
- project-name-4
- project-name-5
- project-name-6
- project-name-7
- project-name-8
- project-name-9
```

Closes angular#23481
@alan-agius4 alan-agius4 self-assigned this Jul 1, 2022
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jul 1, 2022
…ands when run outside of a project

With this change we improve the error message when a project for command cannot be determined

```
Error: Cannot determine project for command.
This is a multi-project workspace and more than one project supports this command. Run "ng build [project]" to execute the command for a specific project or change the current working directory to a project directory.

Available projects are:
- project-name-0
- project-name-1
- project-name-2
- project-name-3
- project-name-4
- project-name-5
- project-name-6
- project-name-7
- project-name-8
- project-name-9
```

Closes angular#23481
clydin pushed a commit that referenced this issue Jul 1, 2022
…ands when run outside of a project

With this change we improve the error message when a project for command cannot be determined

```
Error: Cannot determine project for command.
This is a multi-project workspace and more than one project supports this command. Run "ng build [project]" to execute the command for a specific project or change the current working directory to a project directory.

Available projects are:
- project-name-0
- project-name-1
- project-name-2
- project-name-3
- project-name-4
- project-name-5
- project-name-6
- project-name-7
- project-name-8
- project-name-9
```

Closes #23481
clydin pushed a commit that referenced this issue Jul 1, 2022
…ands when run outside of a project

With this change we improve the error message when a project for command cannot be determined

```
Error: Cannot determine project for command.
This is a multi-project workspace and more than one project supports this command. Run "ng build [project]" to execute the command for a specific project or change the current working directory to a project directory.

Available projects are:
- project-name-0
- project-name-1
- project-name-2
- project-name-3
- project-name-4
- project-name-5
- project-name-6
- project-name-7
- project-name-8
- project-name-9
```

Closes #23481

(cherry picked from commit dbe0dc1)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2022Q3 Fixit Candidates for the Q3 2022 fix-it area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity2: inconvenient type: bug/fix
Projects
None yet
2 participants