nrwl / nx-console

Nx Console is the user interface for Nx & Lerna.
https://nx.dev
MIT License
1.31k stars 211 forks source link

Multiple terminal popups on Windows #2149

Closed cskiwi closed 1 month ago

cskiwi commented 5 months ago

Current Behavior

Whenever I make a change in my project after updating to 19.1.0 a couple of terminals popup for a millisecond and then closing again. Making the whole experience very disturbing because it takes the focus. Making it very hard to work

Expected Behavior

No popups or at least not ones that take the active focus

Steps to Reproduce

Have a project using nx 19.1.0 on windows

Failure Logs / Images / Videos

This is the same as: https://github.com/nrwl/nx-console/issues/1751

Environment

nx report:

Node   : 20.12.2
OS     : win32-x64
bun    : 1.1.10

nx                 : 19.1.0
@nx/js             : 19.1.0
@nx/jest           : 19.1.0
@nx/linter         : 19.1.0
@nx/eslint         : 19.1.0
@nx/workspace      : 19.1.0
@nx/angular        : 19.0.2
@nx/devkit         : 19.1.0
@nx/eslint-plugin  : 19.1.0
@nx/nest           : 19.1.0
@nx/node           : 19.1.0
@nx/playwright     : 19.1.0
@nrwl/tao          : 19.1.0
@nx/web            : 19.1.0
@nx/webpack        : 19.1.0
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
@nx/playwright/plugin
@nx/webpack/plugin
---------------------------------------
Community plugins:
@auth0/auth0-angular : 2.2.3
apollo-angular       : 7.0.1
ng-apexcharts        : 1.10.0
ng-process-env       : 16.0.6
ngxtension           : 3.3.0
---------------------------------------
The following packages should match the installed version of nx
  - @nx/angular@19.0.2
  - @nrwl/angular@19.0.2

I know that angular is still on a prev version of nx because one package hasn't updated to the new angular material formatting giving an error. but I wouldn't think this would cause that issue

MaxKless commented 5 months ago

Hey @cskiwi thanks for the report! We're aware of this issue and are working on a fix :) It has to do with a misconfiguration in how Nx runs things. The default set by Node.js when running any commands on windows is to show a popup like this. So sometimes we miss instances and forget to disable this "feature". I'll let you know once we land something to fix it.

Den-dp commented 5 months ago

@MaxKless if I understand the problem correctly, it can be solved once and for all by implementing workspace-wide ESLint rule for Nx Monorepo that fails if exec, spawn, fork etc are used without hideWindows parameter

CodeWithBryan commented 4 months ago

Everytime I come back to NX, this continues to be an issue. As someone that used to be a supporter of NX, it's very frustrating to be unable to use it outright. Given the severity of this issue, I would've expected an urgent fix, yet here we are months later still dealing with this on windows.

Yet another project I've had to pass NX usage on because of this exact cmd prompt popping issue.

MaxKless commented 4 months ago

Hey @CodeWithBryan I'm really sorry to hear about this. I tried reproducing on my windows machine and didn't see any popups on neither 19.1 nor latest. Could you paste your nx report and let me know what steps you're taking to see the popups? Like, what commands are you running, are you using them from just the nx cli or Nx Console?

@cskiwi are you still running into this too on the latest versions?

nicolasebner commented 4 months ago

I have the same issue, my colleague working on the same project as well. This is really annoying.

I get cmd consoles popping up from: nx\src\daemon\server\start.js

Here my nx report:

Node : 20.14.0 OS : win32-x64 bun : 1.1.6

nx : 19.2.3 @nx/js : 19.2.3 @nx/jest : 19.2.3 @nx/linter : 19.2.3 @nx/eslint : 19.2.3 @nx/workspace : 19.2.3 @nx/cypress : 19.2.3 @nx/devkit : 19.2.3 @nx/eslint-plugin : 19.2.3 @nx/nest : 19.2.3 @nx/node : 19.2.3 @nx/react : 19.2.3 @nrwl/tao : 19.2.3 @nx/web : 19.2.3 @nx/webpack : 19.2.3 typescript : 5.4.5

Registered Plugins: @nx/webpack/plugin @nx/eslint/plugin @nx/jest/plugin

MaxKless commented 4 months ago

Hey thanks everyone for the reports! @cskiwi @nicolasebner Thanks to the nx report results I could track it down to the bun usage and have a fix in this PR https://github.com/nrwl/nx/pull/26718

@Den-dp you're right it might be time to find a solution to prevent this behaviour altogether. I'll talk about it with the team.

MaxKless commented 4 months ago

Should be released later this week :)

Den-dp commented 2 months ago

@MaxKless if I understand the problem correctly, it can be solved once and for all by implementing workspace-wide ESLint rule for Nx Monorepo that fails if exec, spawn, fork etc are used without hideWindows parameter

@MaxKless speaking of the workspace-wide ESLint rule... Not sure whether it is still relevant to you, but while trying to fix a similar issue in nx-dotnet/nx-dotnet#887, I came up with the following rule https://github.com/nx-dotnet/nx-dotnet/pull/887/commits/253663f2ad5d0a377ae830cade74cc19868eeb7e#diff-8f4b5073d52c957e7a4de5f5972eff8864a33308a60905f02cc5f80964e9fde8

mklueh commented 1 month ago

Still happening with 19.7.3...

no matter if I run serve, nx g app or just use IntelliJ with the Nx Plugin installed, I constantly see these windows popping up.

I had to disable the IntelliJ plugin because those windows stayed open and were frozen all the time

MaxKless commented 1 month ago

Yikes I'm sorry to hear that :/ I'll check it out today and see if I can repro it. Can you post your nx report results. Since it doesn't happen for me, I assume it's some code in a specific plugin on windows.

absurdism2 commented 1 month ago

guys, please prioritize this as much as it is possible for you. This really reduces productivity by a lot, on every file change in either of main IDEs you get n (3-10) popping out cmd windows (windows platform).

Node : 20.17.0 OS : win32-x64 Native Target : x86_64-windows npm : 10.8.1

nx (global) : 19.1.2 nx : 19.6.4 @nx/js : 19.6.4 @nx/jest : 19.6.4 @nx/linter : 19.6.4 @nx/eslint : 19.6.4 @nx/workspace : 19.6.4 @nx/angular : 19.6.4 @nx/cypress : 19.6.4 @nx/devkit : 19.6.4 @nx/eslint-plugin : 19.6.4 @nx/react : 19.6.4 @nx/storybook : 19.6.4 @nrwl/tao : 19.6.4 @nx/vite : 19.6.4 @nx/web : 19.6.4 @nx/webpack : 19.6.4 typescript : 5.5.4

Registered Plugins: @nx/eslint/plugin @nx/storybook/plugin @nx/vite/plugin

Community plugins: @koliveira15/nx-sonarqube : 4.1.0 @storybook/angular : 8.2.9 angular-auth-oidc-client : 18.0.1

MaxKless commented 1 month ago

Will do! On it today :)

absurdism2 commented 1 month ago

any update on the issue? this issue is literally unbearable.

MaxKless commented 1 month ago

I've seen these before but I'm really struggling to reproduce the issue on my windows machine. Could you provide a reproduction repo that I can clone and see the issue myself @absurdism2 @mklueh? It must be some specific combination of plugins or the like that's causing this. Usually these popups don't come from Nx Console but from the underlying nx version itself.

I'd love to fix this ASAP but it's hard if I don't see the error myself.

mklueh commented 1 month ago

@MaxKless I can try that, but is it possible to get logs on what is opening the cmd with which arguments?

Maybe it's easier instead of building a reproducer project, and maybe it's something on my machine specifically.

MaxKless commented 1 month ago

You could try setting NX_VERBOSE_LOGGING=true and run some commands like nx show projects that calculate the project graph. Then you should also see the popups. Or is it only ever happening in Nx Console and never in the cli itself?

absurdism2 commented 1 month ago

it does pop up whether you have nx-console installed or not (in my case Webstorm), "nx show projects" does trigger, popups, to check i uninstalled it. If i have nx console installed when it refreshes the workspace automatically it does trigger them too, it is not only when you save the file. Work like that is a torment.

Den-dp commented 1 month ago

@MaxKless I found one of the problematic places while going through @absurdism2's report:

@nx/vite : 19.6.4 https://github.com/nrwl/nx/blob/19.6.4/packages/vite/src/utils/executor-utils.ts#L34

absurdism2 commented 1 month ago

hi, unfortunately i can not share my repo. What i could add is that i see these terminals being run for e.g. git config, npm evec vite, both as admin and normal user, mainly these are "npm exec vite", run couple of times. I did not have this issue before updating nx to latest version.

MaxKless commented 1 month ago

So I couldn't figure out exactly where the issue was in the nx repo but I do have a PR to prevent all these messages: https://github.com/nrwl/nx/pull/28073

Once it's released, let's make sure this is resolved!

Den-dp commented 1 month ago

but I do have a PR to prevent all these messages: nrwl/nx#28073

81 files - that's an impressive amount of work 👏 thanks!

absurdism2 commented 1 month ago

when r u guys planning on releasing it ?

MaxKless commented 1 month ago

very soon, you should see a beta or canary release within the day. Proper release this week I think

MaxKless commented 1 month ago

Hey! We just cut a release 19.8.1 that contains this. Can you update and confirm that the issue is gone?

absurdism2 commented 1 month ago

Hi. Problems still there, however i see this is happening only on latest webstorm only now.

absurdism2 commented 1 month ago

your fixes however did move issue forward, previously on every file change (save) I had ton of these terminals, now they only appear when workspace is being refreshed via nx console (webstorm plugin). after uninstalling it all seems fine now, which is inline with what people report here too: https://github.com/nrwl/nx-console/issues/1751

MaxKless commented 1 month ago

That's nice! Are you on the latest nx console version for webstorm? I just released 1.32.1 which adds windowsHide in a couple of places in Nx Console as well. So those notifications should be gone.... Can you confirm that it still happens with that version?