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

On Windows: cmd.exe window briefly pops up every time a file is edited while running: "nx serve" (taking focus away from my editor window) #16663

Closed
hi2u opened this issue Apr 30, 2023 · 4 comments · Fixed by #16671
Assignees

Comments

@hi2u
Copy link
Contributor

hi2u commented Apr 30, 2023

Current Behavior

  • I'm on Windows 10
  • While running nx serve <appname> with an app generated via nx g @nx/node:application...
  • Almost every time I edit / save a source code file for the app, a black DOS / cmd.exe window pops up briefly, and then disappears.
  • Here's a screenshot I grabbed out of a video screen recording:

2023-05-01_070501 - 2023-05-01_070406_CAPTURA mp4 - Avidemux

  • This makes it very hard to work on my code, because it keeps temporarily stealing keyboard focus away from my editor to the cmd.exe window, then screws stuff up because my editor missed some of the keystrokes I typed while it lost focus.
  • It was mentioned on Slack that this has occurred in the past and was fixed.
    • ...So this appears to be a regression in Nx v16.0.0
    • If I check out my final commit before upgrading (which was on Nx v15.9.2) and run npm i to downgrade back to Nx v15.9.2, then the problem does not occur.
    • I did search through the old issues looking for something on this subject, but couldn't find anything. If anybody does, please link them.

Expected Behavior

  • nx serve should not do anything that could cause Windows to open a new cmd.exe window.

GitHub Repo

No response

Steps to Reproduce

  1. Be on Nx v16.0.0
  2. Create a new app with: nx g @nx/node:application cmdbugapp --e2eTestRunner=none (pick framework: none)
  3. Run nx serve cmdbugapp on Windows
  4. Open apps\cmdbugapp\src\main.ts file in any editor
  5. Save the file to disk a bunch of times

Every once in a while you should see the black cmd.exe window pop up momentarily, like in the screenshot above. It's not always immediate, sometimes it's about 1 or 2 seconds after. And maybe it doesn't occur 100% of the time (or maybe just not always noticeable). But if you do a bunch of saves, you should see it enough.

Nx Report

Node   : 16.14.0
   OS     : win32 x64
   npm    : 9.6.5
   Hasher : Native

   nx (global)             : 16.0.0
   nx                      : 16.0.0
   @nx/js                  : 16.0.0
   @nrwl/js                : 16.0.0
   @nx/jest                : 16.0.0
   @nrwl/jest              : 16.0.0
   @nx/linter              : 16.0.0
   @nrwl/linter            : 16.0.0
   @nx/workspace           : 16.0.0
   @nrwl/workspace         : 16.0.0
   @nx/cypress             : 16.0.0
   @nrwl/cypress           : 16.0.0
   @nx/devkit              : 16.0.0
   @nrwl/devkit            : 16.0.0
   @nx/esbuild             : 16.0.0
   @nrwl/esbuild           : 16.0.0
   @nx/eslint-plugin       : 16.0.0
   @nrwl/eslint-plugin-nx  : 16.0.0
   @nx/express             : 16.0.0
   @nrwl/express           : 16.0.0
   @nx/node                : 16.0.0
   @nrwl/node              : 16.0.0
   @nx/react               : 16.0.0
   @nrwl/react             : 16.0.0
   @nrwl/tao               : 16.0.0
   @nx/web                 : 16.0.0
   @nrwl/web               : 16.0.0
   @nx/webpack             : 16.0.0
   @nrwl/webpack           : 16.0.0
   typescript              : 4.9.5

Failure Logs

No response

Additional Information

No response

@hi2u hi2u added the type: bug label Apr 30, 2023
@AgentEnder AgentEnder added the scope: misc Misc issues label Apr 30, 2023
@AgentEnder AgentEnder self-assigned this Apr 30, 2023
@amir-khoshbakht
Copy link

same problem.
os : windows 8 x64
After I upgraded from version 15 to 16, I noticed that every time the file is saved, the terminal window related to the NX server flashes.
I created an empty workspace with only one empty Next.js app. By running the Next app with the nx run next:serve command, a problem is created and it is not solved even by stopping next serve command.
((next is the name of empty next app ))
then noticed a node process remains open. the node process is using is running ........../node_modules/nx /src/deamon/server/start.js
after closing the mentioned process terminal window stops flashing on each save

@defaultbranch
Copy link

defaultbranch commented May 1, 2023

I see the same since updating to Nx 16;
this had been fixed previously for Nx 15 with #14965,
but moving to Nx 16, the fix was removed again (maybe at or around commit 3703846)

Is there a quickfix? Can NX_NON_NATIVE_HASHER help to fix the behavior?

  • Windows 10
  • Node.js 18.16.0 (LTS)
  • git 2.37.0.windows.1 (from MinGW-w64, came with GitBash)

@AgentEnder
Copy link
Member

I don't think NX_NON_NATIVE_HASHER will help, as this isn't in hashing this time around.

@github-actions
Copy link

github-actions bot commented Jun 1, 2023

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 Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants