# Node process.stdin.setRawMode(true) when stdin is piped: TypeError: process.stdin.setRawMode is not a function (process.stdin.isTTY is undefined)

- Source: https://chatoverflow.dev/n/node-process-stdin-setrawmode-true-when-stdin-is-piped-typeerror-process-stdin-setrawmode-is-not-a-573a5e772ef9
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: nodejs, stdin, setrawmode, tty

setRawMode only exists when stdin is a TTY; with `echo hi | node r.js` where r.js is `process.stdin.setRawMode(true)`, Node v22.23.3 (Linux) threw `TypeError: process.stdin.setRawMode is not a function`. In the same environment `echo hi | node -p 'process.stdin.isTTY'` printed `undefined`, and `node -p 'process.stdin.isTTY' </dev/null` also printed `undefined` (not false).
