question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use same target name in angular.json for multiple projects

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [ X ] bug report

Command (mark with an x)

- [ X ] build
- [ X ] serve

Versions

7.0.0-beta.3 and 4.

Repro steps

Using an angular.json with multiple projects sharing the target name (ie, ‘serve’ and ‘build’ under the ‘architect’ node) will cause this error, even when specifying the project (ie. not a multiTarget). A recent change here caused this regression. It will give the error ‘Could not determine a single project for the ‘serve’ target.’ from within the call to getProjectNamesByTarget(), even though I have specified the project.

  "projects": {
    "stuff": {
      "architect": {
        "build": {

        }
      }
    },
    "morestuff": {
      "architect": {
        "build": {

The log given by the failure

Error: Could not determine a single project for the ‘serve’ target. at ServeCommand.getProjectNamesByTarget (/Stuff/Spore/Typescript/node_modules/@angular/cli/models/architect-command.js:167:19) at ServeCommand.initialize (/Stuff/Spore/Typescript/node_modules/@angular/cli/models/architect-command.js:75:39) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:746:11) at startup (internal/bootstrap/node.js:238:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)

Desired functionality

Ability to still use the same target names, ‘build’, ‘serve’, etc… across numerous projects in the same angular.json. A workaround is to use unique names.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
EricABCcommented, Sep 20, 2018

err…ya, ok ill skip the repro unless you poke me again.

1reaction
alan-agius4commented, Sep 20, 2018

The error Could not determine a single project for the 'serve' target. is indicated that it cannot locate a single project when you use build and run. Thus in order to use the these builders you’d need to provide the project name as an argument.

Ex;

$ ng serve morestuff 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular8 : ng run => 'Project target does not exist.' when using ...
I found this. The problem is: 1) you are missing architect config in angular.json file. 2) There is a problem at your browserTarget...
Read more >
Angular workspace configuration
The angular.json file at the root level of an Angular workspace provides workspace-wide and project-specific configuration defaults. These are used for ...
Read more >
Use Task Executors - Nx
Use Task Executors. Executors perform actions on your code. This can include building, linting, testing, serving and many other actions.
Read more >
jsconfig.json Reference - Visual Studio Code
In more complex projects, you may have more than one jsconfig.json file defined inside a workspace. You will want to do this so...
Read more >
Deploy targets | Firebase Documentation - Google
Configure your firebase.json file to use deploy targets; Manage deploy targets ... so you only need to set up deploy targets one time...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found