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.

nx run-many only serves the first 3 specified projects

See original GitHub issue
  • I am running the latest version "@nrwl/workspace": "^8.8.0"
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I’m reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)

Expected Behavior

all specified projects get served, when running nx run-many --target=serve --projects=<more than 3 projects> --parallel

Current Behavior

only the first 3 projects get served

Failure Information (for bugs)

console outputs:

nx run-many --target=serve --projects=one,two,three,four --parallel

NX  Running target serve for projects:

  - one
  - two
  - three
  - four
nx-min@0.0.0 nx <path-to-project>\nx-min
nx "run" "two:serve"

nx-min@0.0.0 nx <path-to-project>\nx-min
nx "run" "three:serve"

nx-min@0.0.0 nx <path-to-project>\nx-min
nx "run" "one:serve"

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. npx create-nx-workspace@latest nx-min
  2. cd nx-min
  3. nx g @nrwl/nest:application one
  4. nx g @nrwl/nest:application two
  5. nx g @nrwl/nest:application three
  6. nx g @nrwl/nest:application four
  7. change ports so that all four have unique ports
  8. nx run-many --target=serve --projects=one,two,three,four --parallel

Context

Please provide any relevant information about your setup:

  • nx report :
  @nrwl/angular : Not Found
  @nrwl/cli : 8.8.0
  @nrwl/cypress : Not Found
  @nrwl/eslint-plugin-nx : 8.8.0
  @nrwl/express : Not Found
  @nrwl/jest : 8.8.0
  @nrwl/linter : 8.8.0
  @nrwl/nest : 8.8.0
  @nrwl/next : Not Found
  @nrwl/node : 8.8.0
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 8.8.0
  @nrwl/web : Not Found
  @nrwl/workspace : 8.8.0
  typescript : 3.5.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

14reactions
AdamVigcommented, Nov 22, 2019

You should be able to work around this by setting the --maxParallel flag to a high number, for example:

nx run-many --target=serve --projects=one,two,three,four --parallel --maxParallel=100

The default value for --maxParallel is three, meaning that it runs tasks in batches of three by default. Since the “serve” target never exits, the run-many command never made it to the second batch of tasks.

To avoid further confusion about this situation, there could be a warning logged when the “serve” target is used with the run-many command.

3reactions
mkashifsnydercommented, Jan 10, 2021

Just have a quick question how we can serve multiple applications with port as well… For example previously we were doing like that ng serve appname --port=5200 ng serve appname2 --port=5201

Can we do that with nx run-many based on following example apps AngularApp1 AngularApp2 NestApp1 NestApp2

then the command should be like that nx run-many --target=serve --projects=AngularApp1,AngularApp2,NestApp1,NestApp2 --port=5200,5201 --parallel --maxParallel=4

notice i have provided port numbers for only angular applications and for the nest we can control that from environment files

Read more comments on GitHub >

github_iconTop Results From Across the Web

run-many - CLI command - Nx
Run target for multiple listed projects.
Read more >
Nx CLI run many command is not working for multiple apps
Try this: nx run-many --parallel --target=serve --projects=frontend,backend.
Read more >
Use Nx run-many to Run Commands in Multiple Projects
You can run multiple projects using the run-many command from Nx and setting a --target flag with the command you want to run....
Read more >
How to Deploy Nx monorepos to Netlify
If you were looking for different strategies to deploy only the ... Part 3 – Using builders in Nx to deploy specific projects...
Read more >
Set Your Multi-App Environment up in 5 Minutes - Dev Genius
nx run-many --target=serve --projects=client,backoffice,api ... file structure, and build, serve, lint, and test flows just in 3 minutes using 4 commands?
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