nx: Error Popup on every nx command (probably from node_modules\nx\src\daemon\server\start.js)
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)]:

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, chooseangularandscssand 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:
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 16
- Comments: 43 (3 by maintainers)
Commits related to this issue
- chore: Update to Lerna v6 Relates to #1543 Running into this issue: https://github.com/nrwl/nx/issues/10822#issuecomment-1326795930 which prevents me from moving over to this on master right now. — committed to vendure-ecommerce/vendure by michaelbromley 2 years ago
- fix(core): remove Windows cmd window popups (#14965) Fixes https://github.com/nrwl/nx/issues/10822 — committed to nrwl/nx by Cammisuli a year ago
Oh, I want to clarify that there was no issue with the @parcel/watcher package. I found the issue that I was coming across that was only in the Nx repo. I’ll have a PR up to fix this soon.
Hey all, I found the root cause of this. And it comes in two parts:
detached: truein that spawn call.We’re really sorry that it’s taken this long to come to a root cause, and thank you everyone for your patience and understanding.
The light is visible at the end of this tunnel 🙂
It happens to me as well and it’s driving me insane
Not a stale.
i think its one process per lib in this daemon or so…
https://user-images.githubusercontent.com/833192/216442205-70ba41f7-e5c3-4e3f-adff-42d6e1bd3b00.mp4
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.
I haven’t been involved in the daemon for a long time I’m afraid so can’t comment further. Rest assured folks this is a top priority for the team to resolve, please follow Miro’s advice about disabling the daemon in the meantime
Not stale.
Sorry for this persistent annoying problem. You can switch off
daemonby setting the env variableNX_DAEMON=falsewhich will stop the daemon from being started. Unfortunately, you will also lose all the benefits. The daemon runs in the background and recalculates the project graph on every change so that when you run thenxcommand in the terminal or within your IDE (e.g.eslint) the graph is already up to date and there is no cold start or graph mismatch (in case of IDE).But based on your reports, it seems that the
daemonis crashing anyway so you wouldn’t lose much.Perhaps @JamesHenry can provide more information as he was the original author of that functionality.
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. 😿
Not stale.
Not stale, and has gotten much worse with the last update.
As far as I can see, the
--background=falseflag does not exists/work anymore. I couldn’t find any reference to it in the docs ornx daemon helpanymore 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.
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:
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