Node executable on Windows mingw 'output is not a tty'

Revision history
Tags: node.js windows mingw

On my Windows computer I am using mingw (Git Bash) for my terminal emulator as it’s the closest I’ve gotten to a native Linux terminal.

I am generating some HTML with a node program I’ve written and I’m trying to redirect stdout to a file

$ node generate-html.js > output.html
output is not a tty

$ echo $?
1

I don’t know why my terminal isn’t recognized as a TTY, but apparently it has something to do about how the terminal is emulated on Windows. A solution is to execute it as a command argument to bash instead.

$ bash -c "node generate-html.js > output.html"

$ head -n 1 output.html
<DOCTYPE html>

Looks good :)

If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom).

Did you find any typos, incorrect information, or have something to add? Then please propose a change to this post.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.