Node error: stdout is not a tty [Fixed]

When you try to pipe output to a file in Windows / msysgit or git bash, you may get this error:

$ node cmd.js > retrieve.sh
stdout is not a tty

Rather than writing to the file via shell, do this:

var writable = fs.createWriteStream('retrieve.sh', {flags:'w'});
writable.write('mkdir -p ' + path + '\n');
writable.write(
  'curl -o ' + path + entry.id + '.txt "' + entry.url + '"\n'
);

Interested in JavaScript? I send out weekly, personalized emails with articles and conference talks. Click here to see an example and subscribe.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *