Nx not using terminal UI
Current Behavior
Running nx commands looks exactly like it did with previous versions
Expected Behavior
Expecting to see the new terminal UI when I run nx commands in the terminal
GitHub Repo
https://github.com/nrwl/nx-examples
Steps to Reproduce
- Clone repo
- Install dependencies
- Run
npm run test
Nx Report
NX Report complete - copy this into the issue template
Node : 22.2.0
OS : darwin-x64
Native Target : x86_64-macos
yarn : 4.2.2
nx : 21.0.0-rc.4
@nx/js : 21.0.0-rc.4
@nx/jest : 21.0.0-rc.4
@nx/eslint : 21.0.0-rc.4
@nx/workspace : 21.0.0-rc.4
@nx/angular : 21.0.0-rc.4
@nx/cypress : 21.0.0-rc.4
@nx/devkit : 21.0.0-rc.4
@nx/eslint-plugin : 21.0.0-rc.4
@nx/module-federation : 21.0.0-rc.4
@nx/react : 21.0.0-rc.4
@nx/rspack : 21.0.0-rc.4
@nx/web : 21.0.0-rc.4
@nx/webpack : 21.0.0-rc.4
typescript : 5.7.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/cypress/plugin
@nx/jest/plugin
---------------------------------------
Community plugins:
@ngrx/component-store : 19.0.0
@ngrx/effects : 19.0.0
@ngrx/entity : 19.0.0
@ngrx/operators : 19.0.0
@ngrx/router-store : 19.0.0
@ngrx/store : 19.0.0
@ngrx/store-devtools : 19.0.0
---------------------------------------
Cache Usage: 4.21 KB / 93.15 GB
Failure Logs
Package Manager Version
yarn 4.2.2
Operating System
- [x] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
I get the same behaviour in my own monorepo which is NX v21.3
@claude Can you look at the logic for when the TUI is enabled and propose some things for the user to check please?
Claude finished @FrozenPandaz's task —— View job
I've analyzed the TUI enablement logic in the Nx codebase and compiled troubleshooting steps for @benwainwright.
How Nx Determines TUI Enablement
The TUI enablement logic is in /packages/nx/src/tasks-runner/is-tui-enabled.ts and follows this priority order:
- Terminal Capability Check: Must support TTY and Unicode
- CLI Arguments:
--output-styleflag (highest priority) - Environment Variable:
NX_TUI=true/false - Environment Detection: CI/Windows/WASM checks
- nx.json Configuration:
tui.enabledproperty - Default: Enabled if system is capable
Troubleshooting Steps
Here are the most likely causes and things to check:
1. Check Environment Variables
# Check if NX_TUI is set to false
echo $NX_TUI
# Check if you're in a CI-like environment
echo $CI
echo $GITHUB_ACTIONS
echo $BUILDKITE
# ... (various CI environment variables)
2. Check Terminal Capability
# Verify TTY support
node -e "console.log('TTY:', process.stderr.isTTY)"
# Check your TERM environment variable
echo $TERM
echo $TERM_PROGRAM
3. Verify CLI Arguments
- Check if you're using
--output-stylewith values likestatic,stream, ordynamic-legacy - Try explicitly enabling TUI:
npm run test -- --output-style=tui
4. Check nx.json Configuration
Look for a tui section in your nx.json:
{
"tui": {
"enabled": false // This would disable TUI
}
}
5. Test Direct Nx Commands
Instead of npm run test, try running Nx directly:
# Force TUI mode
NX_TUI=true npx nx run-many --target=test --output-style=tui
# Or with explicit output style
npx nx run-many --target=test --output-style=tui
6. Debug TUI Enablement
Add this temporary debug script to see what's happening:
node -e "
const { shouldUseTui } = require('./node_modules/nx/src/tasks-runner/is-tui-enabled');
const { readNxJson } = require('./node_modules/nx/src/config/nx-json');
console.log('TUI enabled:', shouldUseTui(readNxJson(), { outputStyle: undefined }));
"
Most Likely Causes
Given your setup (macOS, Node 22.2.0, Nx 21.0.0-rc.4):
- Hidden CI Environment: Some environment variable might be making Nx think you're in CI
- npm script wrapper: The
npm run testcommand might be setting--output-styleto something other thantui - nx.json configuration: The repo might have
tui.enabled: false - Terminal emulator: Your terminal might not be reporting TTY capability correctly
Quick Fix Attempts
Try these in order:
# 1. Force TUI via environment variable
NX_TUI=true npm run test
# 2. Use direct nx command with explicit TUI
npx nx run-many --target=test --output-style=tui
# 3. Skip capability check (for debugging)
NX_TUI_SKIP_CAPABILITY_CHECK=true NX_TUI=true npm run test
Let me know what you find with these checks, and I can help narrow down the specific issue!
-
None of these environment variables are set
❯ node -e "console.log('TTY:', process.stderr.isTTY)"
TTY: true
~/repos/nx-examples master
❯ echo $TERM
echo $TERM_PROGRAM
xterm-256color
WezTerm
- No flags of any kind are being used, but... when I add it explicitly with
npm run test -- --output-style=tuiit does work - There is nothing related to the tui in my
nx.json - For both options in this section, the tui does work
~/repos/nx-examples master
❯ node -e "
const { shouldUseTui } = require('./node_modules/nx/src/tasks-runner/is-tui-enabled');
const { readNxJson } = require('./node_modules/nx/src/config/nx-json');
console.log('TUI enabled:', shouldUseTui(readNxJson(), { outputStyle: undefined }));
"
TUI enabled: false
For all the options in the 'quick fix attempts' section, the tui DOES work, which is great... however, I don't consider this a fix - there is nothing in the documentation that suggests I should have to enable this feature explicitly, and I'd prefer not to have to do it for every command.
is this related to #31588 and #31586 ?
@guesant - no, its not. This is related to nx using the regular terminal output instead of the tui.
@benwainwright - Hey, thanks for looking through the AI help and confirming things are working when explicitly set. Can you add some console logs into the is-tui-enabled file and determine which check there is returning false? Looking through it on my end there's not an obvious reason that it would default to a different value for you.
@AgentEnder it looks like the reason that is-tui-enaabled is returning false is because it thinks my shell is CI.
This is returning true
Ok, after looking into how it worked out something is CI, I had a look through my environment variables. Will you look at that...
Hanging around in my dotfiles, leftover from my time working at the BBC. Happy to consider this closed...
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.