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

Angular 17 with :application executor runs into blocking console issues #22731

Closed
1 of 4 tasks
ErickRodrCodes opened this issue Apr 8, 2024 · 7 comments
Closed
1 of 4 tasks

Comments

@ErickRodrCodes
Copy link

ErickRodrCodes commented Apr 8, 2024

Current Behavior

Environment: Windows 10 Enterprise 22H2

In random cases, when serving Angular 17 with the application executioner, it tends to block the terminal with some incomplete characters:

image

while this happens the task runner is in a lethargic state:

image

Only after pressing CTRL + C, the terminal unfreezes, and you can input a serving command as R, Q or H

Note that sometimes it works, and in this case, I had to kill it:

image

and the worst-case scenario is I have to kill every single node process if CTRL+C doesn't work with

Get-Process -Name node | Stop-Process

I suspect the issue is located with chalk, other coloring library, or simply the spinner prevents to run something when rendering on the terminal. I even ensured it takes FORCE_COLOR=0 to prevent any color rendering. Reason I'm suspecting of it is for the similar output I get on build on CI:

image

Expected Behavior

It just should serve. It started to happen after migrating to Angular 17 and set up the executor as @angular-devkit/build-angular:application

GitHub Repo

No response

Steps to Reproduce

  1. unfortunately it is totally random and I can reproduce it every single time. However, it is quite frequent if you have @angular-devkit/build-angular:application on the codebase. just run in powershell nx serve your-angular-app and sporadically will show up a blocking set of strings.

Nx Report

Report complete - copy this into the issue template

Node : 18.18.2

OS : win32-x64

npm : 9.8.1

nx (global) : 18.1.2
nx : 18.1.2
@nx/js : 18.1.2
@nx/jest : 18.1.2
@nx/linter : 18.1.2
@nx/eslint 18.1.2
@nx/workspace 18.1.2
@nx/angular : 18.1.2
@nx/devkit : 18.1.2
@nx/esbuild : 18.1.2
@nx/eslint-plugin : 18.1.2
@nx/express 18.1.2
@nx/node : 18.1.2
@nrwl/tao : 18.1.2
@nx/web : 18.1.2
@nx/webpack : 18.1.2
typescript : 5.3.3

Community plugins:
@testing-library/angular : 13.0.1

angular-auth-oidc-client : 16.0.1
ng-mocks : 14.12.1

Failure Logs

it block the terminal, so no logs are really visible

Package Manager Version

npm 9.8.1

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

as a preventive measure I tried to run cross-env FORCE_COLOR=0 CI=true to ensure coloring won't happen, however something is triggering some strange character that blocks the terminal to continue.

@ErickRodrCodes
Copy link
Author

ErickRodrCodes commented Apr 8, 2024

It seems that setting on the executer options the option verbose to false fixes the issue. it won't show the building spinner, and it seems it might work. however you can't command vite to reload, open or quit the application.

@ErickRodrCodes
Copy link
Author

Additional: the ANSI Escape sequence has something to do here:

https://en.wikipedia.org/wiki/Escape_sequence

The ^[[8; escape sequence is only supported by some terminals. If you are using a terminal that does not support it, the concealed text will be displayed normally. The ^[[8; escape sequence can be used to conceal any type of text, including text that is already colored. The ^[[8; escape sequence can be combined with other ANSI escape sequences to create more complex effects. For example, you could use the ^[[8; escape sequence to conceal text that is also blinking or underlined.

@pkelleter
Copy link

pkelleter commented Apr 9, 2024

same issue here. upgrading node from 16 to 20 improved the issue from happening almost-always to decently-often - but it still persists in general.

@ErickRodrCodes would you be so nice to elaborate on how/where exactly to put verbose to false in the config? :)

@ErickRodrCodes
Copy link
Author

ErickRodrCodes commented Apr 9, 2024

same issue here. upgrading node from 16 to 20 improved the issue from happening almost-always to decently-often - but it still persists in general.

@ErickRodrCodes would you be so nice to elaborate on how/where exactly to put verbose to false in the config? :)

Sure thing.

In your project.json browse: targets -> build -> options, then set an option called "verbose" to be false. that should be enough.

also add in your environment variables (powershell):

$Env:CI="true"
$Env:FORCE_COLOR=0

to ensure an additional layer of preventing chalk or colors to be in any way rendered on the terminal. I'm seeing it quite persistent with this issue and that helped me also to avoid this issue in some manner. Not ideal, but at least I can work.

@rudfoss
Copy link

rudfoss commented Apr 9, 2024

Just to add I'm seeing this on many different monorepos when running different tasks on both React, Nest and .NET (nx-dotnet). It happens with many different targets including build, serve, test and lint, but not every time. It seems to have started with an update about a month ago. I'm on Windows with Node 20.

Like @ErickRodrCodes says it looks like an attempt to color or format console text so disabling coloring should work, but I think it might be a bug in some internal Nx utility.

@MaxKless
Copy link
Collaborator

Hey thanks for the report! This is a known issue and tracked in #22358.
As a workaround, setting NX_NATIVE_COMMAND_RUNNER=false in your .env file should work.
I'll close this as a duplicate :)

@MaxKless MaxKless closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2024
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants