I want to take the output of a c++ program and input it into the stdin of a javascript file. However I have been unable to push anything into the stdin using the method...
When running your program with redirected stdin, you're connected to a ReadStream, not a TTY, so TTY.setRawMode() isn't supported.
setRawMode() is used to set a tty stream so that it does not process its data in any way, such as providing special handling of line-feeds. Such processed data is referred to as being "cooked".
Standard node ReadStreams are, by definition, already "raw" in that there is no special processing of the data.
So, refactor your code without the call to setRawMode() and it should work fine.