Closed
Description
Current Behavior
When running nx graph --file=stdout
, any additional Nx warnings are included in the output. This is in contrast to nx graph --file=output.json
where they are correctly stripped.
Here's what the ouput looks like now if I try to run it with a wrong node version:
WARN Unsupported engine: wanted: {"node":">=22"} (current: {"node":"v20.14.0","pnpm":"9.15.5"})
{
"graph": {
"nodes": {
...
This is a problem when I want to do further processing on the output, e.g. using jq
:
nx graph --file=stdout | jq '.'
now throws jq: parse error: Invalid numeric literal at line 1, column 11
Expected Behavior
Standard output only contains the resulting JSON, same as when outputting to file
GitHub Repo
No response
Steps to Reproduce
- Ensure Nx throws a warning (e.g. specify different
node
version inpackage.json
engine
section - Run
nx graph --file=stdout
- Warning is now included in output, making it invalid JSON
Nx Report
Node : 20.14.0
OS : darwin-arm64
Native Target : aarch64-macos
pnpm : 9.15.5
nx : 20.7.2
@nx/js : 20.7.2
@nx/eslint : 20.7.2
@nx/workspace : 20.7.2
@nx/cypress : 20.7.2
@nx/devkit : 20.7.2
@nx/module-federation : 20.7.2
@nx/react : 20.7.2
@nx/storybook : 20.7.2
@nx/web : 19.8.14
typescript : 5.8.2
---------------------------------------
Cache Usage: 33.32 MB / 46.04 GB
---------------------------------------
The following packages should match the installed version of nx
- @nx/web@19.8.14
To fix this, run `nx migrate nx@20.7.2`
Failure Logs
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response