nx icon indicating copy to clipboard operation
nx copied to clipboard

Error Popup on every nx command (probably from node_modules\nx\src\daemon\server\start.js)

Open Jejuni opened this issue 3 years ago โ€ข 11 comments

Current Behavior

When running any nx command, like nx run my-app:build or nx run my-app:test for the first time (after a reboot, for instance) a cmd window pops up, simply stating [process exited with code 1 (0x00000001)]:

image

The run still seemingly completes correctly. After that every subsequent run of any nx command completes without error.

On closer inspection I found that a node process is spawned and called with the following arguments:

"C:\Program Files\nodejs\node.exe" C:\my-workspace\node_modules\nx\src\daemon\server\start.js

This process persists even after closing the terminal. Killing this process manually and then running any nx command makes the error come back.

Expected Behavior

No cmd windows with errors pop up.

Steps to Reproduce

This was encountered on a Windows machine version 21H2 (OS Build 22000.739). Used shell was PowerShell Core 7.2.4 AND regular PowerShell 5.1.22000.653

Repro:

  • run npx create-nx-workspace@latest test-workspace, choose angular and scss and cloud integration.
  • run nx run my-app:test
  • Error should appear

Environment

nx report of created workspace:

Node : 16.15.0
OS   : win32 x64
npm  : 8.5.5

nx : 14.3.6
@nrwl/angular : 14.3.6
@nrwl/cypress : 14.3.6
@nrwl/detox : Not Found
@nrwl/devkit : 14.3.6
@nrwl/eslint-plugin-nx : 14.3.6
@nrwl/express : Not Found
@nrwl/jest : 14.3.6
@nrwl/js : 14.3.6
@nrwl/linter : 14.3.6
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : 14.1.2
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.3.6
@nrwl/web : 14.3.6
@nrwl/workspace : 14.3.6
typescript : 4.7.4
---------------------------------------
Community plugins:

Jejuni avatar Jun 20 '22 21:06 Jejuni

This also happens to me. The curious thing is that with the NX Console Plugin installed it spawns a window for the error, but if the extension is disabled it only shows an error inside VSCode. It also stops showing after some time, after VSCode is closed and opened again.

PowerShell Core 7.2.5
Windows 11 22H2
VSCode 1.68.1
Node: 18.4.0
npm 8.12.2
"@nrwl/angular": "^14.3.6",
"@nrwl/cli": "14.3.6",
"@nrwl/cypress": "14.3.6",
"@nrwl/eslint-plugin-nx": "14.3.6",
"@nrwl/express": "^14.3.6",
"@nrwl/jest": "14.3.6",
"@nrwl/linter": "14.3.6",
"@nrwl/node": "14.3.6",
"@nrwl/workspace": "14.3.6",

PointSingularity avatar Jun 28 '22 20:06 PointSingularity

This happens to me too. Since that one node process is never killed after build script, it blocks the dist folder from being rewritten on next build script. Apparently NX thinks the project has no changes made, so it skips building and uses the one from cache - thus leaving you with an outdated build. To fix that you have to manually kill the remaining node process.

NX report:

Node : 16.12.0
OS   : win32 x64
yarn : 1.22.17

nx : 14.3.3
@nrwl/angular : Not Found
@nrwl/cypress : 14.3.3
@nrwl/detox : Not Found
@nrwl/devkit : 14.3.3
@nrwl/eslint-plugin-nx : 14.3.3
@nrwl/express : Not Found
@nrwl/jest : 14.3.3
@nrwl/js : 14.3.3
@nrwl/linter : 14.3.3
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 14.3.3
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : 14.3.3
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.3.3
@nrwl/web : 14.3.3
@nrwl/workspace : 14.3.3
typescript : 4.7.3

NordlingDev avatar Jul 01 '22 21:07 NordlingDev

We have tried to reproduce this but have not been able to. :disappointed:

In https://github.com/nrwl/nx/issues/11247, the user was using the newer Windows Terminal but here I see people are using Powershell + Powershell Core :thinking:

If anybody else has information that might help us reproduce this, please share! We will continue to try to reproduce it with any additional information provided.

FrozenPandaz avatar Jul 29 '22 20:07 FrozenPandaz

We have tried to reproduce this but have not been able to. ๐Ÿ˜ž

In #11247, the user was using the newer Windows Terminal but here I see people are using Powershell + Powershell Core ๐Ÿค”

If anybody else has information that might help us reproduce this, please share! We will continue to try to reproduce it with any additional information provided.

I also posted above. I am on Windows 11, with Windows Terminal, PowerShell 7.2.5. I solved the issue with the popup by disabling the "daemon" in nx.json:

nx.json
...
 "tasksRunnerOptions": {
    "default": {
      "runner": "nx/tasks-runners/default",
      "options": {
        "cacheableOperations": ["build", "lint", "test", "e2e"],
        "useDaemonProcess": false
      }
    }
  }, 
...

I hope this can shine some light on the problem, but I think this is more of a workaround than a full solution.

Edit: I just tried creating a new nx workspace, with a base angular app. When I open the project in VSCode, the terminal window opens up immediately with the error.

Install finishes at around 2:30

https://user-images.githubusercontent.com/56246797/181847367-911582cf-78cd-42b0-89e9-96982cd393e0.mp4

PointSingularity avatar Jul 29 '22 21:07 PointSingularity

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Aug 13 '22 00:08 github-actions[bot]

Not a stale.

unlight avatar Aug 13 '22 05:08 unlight

@FrozenPandaz Windows just gave me this popup, I don't think it is related, just wanted to document it. image

You can check my exact setup here in the video

We have tried to reproduce this but have not been able to. ๐Ÿ˜ž In #11247, the user was using the newer Windows Terminal but here I see people are using Powershell + Powershell Core ๐Ÿค” If anybody else has information that might help us reproduce this, please share! We will continue to try to reproduce it with any additional information provided.

I also posted above. I am on Windows 11, with Windows Terminal, PowerShell 7.2.5. I solved the issue with the popup by disabling the "daemon" in nx.json:

nx.json
...
 "tasksRunnerOptions": {
    "default": {
      "runner": "nx/tasks-runners/default",
      "options": {
        "cacheableOperations": ["build", "lint", "test", "e2e"],
        "useDaemonProcess": false
      }
    }
  }, 
...

I hope this can shine some light on the problem, but I think this is more of a workaround than a full solution.

Edit: I just tried creating a new nx workspace, with a base angular app. When I open the project in VSCode, the terminal window opens up immediately with the error.

Install finishes at around 2:30 deamon.mp4

PointSingularity avatar Aug 23 '22 19:08 PointSingularity

Also now having the same problems as #11247 After using nx generator to add libs / components. 8-10 console windows open and then immediately close again. That was probably there from the beginning, but I haven't used the generators in a while.

Also recently upgraded to node 16.17.0, but problem still persists.

Jejuni avatar Sep 06 '22 07:09 Jejuni

I've spent some more time analyzing the problem.

When navigating to an Nx Project and running nx daemon --start the same problem as described initially appears. That is, a console window spawns that simply states [process exited with code 1 (0x00000001)]. Running nx daemon after that, however, prints Nx Daemon is currently running: and then a link to the logs and a ProcessId.

Using nx daemon --start --background=false to run the daemon in the current process does NOT produce any errors or popups.

I've also tried debugging the daemon.js, but since the error only happens when the code that causes the error runs in the background I've not gotten very far.

@FrozenPandaz does any of this help with troubleshooting the issue on your side?

Jejuni avatar Sep 06 '22 16:09 Jejuni

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Sep 21 '22 00:09 github-actions[bot]

Not stale.

PointSingularity avatar Sep 21 '22 06:09 PointSingularity

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Oct 06 '22 00:10 github-actions[bot]

Not stale, and has gotten much worse with the last update.

As far as I can see, the --background=false flag does not exists/work anymore. I couldn't find any reference to it in the docs or nx daemon help anymore and using the flag still tries to run the daemon in a background process.

All my colleagues are having the same problem on their windows machines. There's no way to work with the nx daemon in its current state and the only course of action is to just disable it.

Please take another look at the problem.

Jejuni avatar Oct 08 '22 13:10 Jejuni

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Oct 23 '22 00:10 github-actions[bot]

I can only agree with @Jejuni. It has become worse on Windows. It would be great if you can fix that. Please do not stale.

rainerhahnekamp avatar Oct 23 '22 18:10 rainerhahnekamp

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Nov 08 '22 00:11 github-actions[bot]

Not stale. @FrozenPandaz any new developments regarding this?

PointSingularity avatar Nov 08 '22 08:11 PointSingularity

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Nov 24 '22 00:11 github-actions[bot]

Not stale.

PointSingularity avatar Nov 24 '22 07:11 PointSingularity

I'd like to share a video of what this looks like for me, running Lerna v6.0.3 on Windows 11. Using git bash in Windows Terminal, but also does the same when run via powershell directly.

https://user-images.githubusercontent.com/6275952/203854975-105242c8-e449-4f89-ad4b-865ed8b24e05.mp4

The worst part is that when the new terminals open, they take focus from whatever app you are working on, making it impossible to use my computer when running tasks in Lerna/Nx.

michaelbromley avatar Nov 24 '22 19:11 michaelbromley

I'd like to share a video of what this looks like for me, running Lerna v6.0.3 on Windows 11. Using git bash in Windows Terminal, but also does the same when run via powershell directly. nx-lerna-opening-tabs.mp4

The worst part is that when the new terminals open, they take focus from whatever app you are working on, making it impossible to use my computer when running tasks in Lerna/Nx.

Not a fix per see, but you might mitigate this by changing this settings in the terminal, to make it so that the tab doesn't persist. image

krokofant avatar Nov 24 '22 20:11 krokofant

@krokofant Thanks - I already had it set like that earlier, but the opening tabs still steal focus even though they immediately close, so unfortunately it is still just as unusable :(

michaelbromley avatar Nov 24 '22 21:11 michaelbromley

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Dec 09 '22 00:12 github-actions[bot]

Still an issue.

michaelbromley avatar Dec 09 '22 07:12 michaelbromley

I also have the Command Prompt Pinata ๐Ÿช…, but I even have it when saving a file that's monitored by Nx.. It's driving me crazy ๐Ÿคฏ

tfrijsewijk avatar Dec 15 '22 11:12 tfrijsewijk

I have the same problem when working in VSCode on Windows 11. It always opens up terminal windows that close again immediately but as they steal focus it is basically not possible to work with it.

raeffs avatar Dec 29 '22 11:12 raeffs

This issue is really embarrassing when trying to promote nx in a demo or so. Kills my machine with popups. Iโ€™m now afraid to demo anything nx on windows. ๐Ÿ˜ฟ

jbadeau avatar Jan 26 '23 19:01 jbadeau

Out of curiosity

  1. what node package manager is everyone using?
  2. Are u using workspaces?

Yarn:yes

jbadeau avatar Jan 26 '23 19:01 jbadeau

@jbadeau Yes, yarn v1.22.19, with workspaces (via Lerna)

michaelbromley avatar Jan 26 '23 19:01 michaelbromley

I have it with npm and yarn. Not using workspaces. It also seems not related to vscode, the popups also pop up when using nx commands in the terminal.

raeffs avatar Jan 26 '23 19:01 raeffs