nx:run-commands output not colored

Trung Vo
Jan 13, 2024

Problem

We are using Nx in our project and recently we want to utlize nx:run-commands to run two commands:

  1. nx serve
  2. open a custom our configured domain

However, we found that the output of the command is not colored.

"serve-open": {
"executor": "nx:run-commands",
"options": {
"commands": [
"nx run my-bank:serve",
"open https://our-custom-domain.local"
],
"parallel": true
}
}

Solution

After visiting some related issues, we found that we need to set --output-style to whether stream or stream-without-prefixes

This 10918#issuecomment-1202731648 is the most helpful one.

"serve-open": {
"executor": "nx:run-commands",
"options": {
"commands": [
- "nx run my-bank:serve",
+ "nx run my-bank:serve --output-style=stream-without-prefixes",
"open https://our-custom-domain.local"
],
"parallel": true
}
}

Now the output looks as expected:

--

--

Trung Vo

A seasoned front-end engineer with 9 years of passion in creating experience-driven products. I am proficient in Angular, React and TypeScript development.