stream-adventure icon indicating copy to clipboard operation
stream-adventure copied to clipboard

Error running on Windows: process.stdin.setRawMode is not a function

Open xxnatc opened this issue 9 years ago • 4 comments

Got stream-adventure to install, but when I try to run it I get this error:

$ stream-adventure
C:\Users\Nat\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\adventure\lib\menu.js:51
    process.stdin.setRawMode(true);
                  ^

TypeError: process.stdin.setRawMode is not a function
    at module.exports (C:\Users\Nat\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\adventure\lib\menu.js:51:19)
    at Shop.showMenu (C:\Users\Nat\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\adventure\index.js:267:16)
    at Shop.execute (C:\Users\Nat\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\adventure\index.js:131:14)
    at Object.<anonymous> (C:\Users\Nat\AppData\Roaming\npm\node_modules\stream-adventure\bin\cmd.js:18:6)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:136:18)

I'm on Win 10 with node v4.2.4. There is a similar issue (#38) but my node version should be supported.

xxnatc avatar Jan 20 '16 06:01 xxnatc

i have the same trouble .i update node version and still not work

$ stream-adventure C:\Users\Windows 8.1\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\adventure\lib\menu.js:51 process.stdin.setRawMode(true); ^

TypeError: process.stdin.setRawMode is not a function at module.exports (C:\Users\Windows 8.1\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\adventure\lib\menu.js:51:19) at Shop.showMenu (C:\Users\Windows 8.1\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\adventure\index.js:267:16) at Shop.execute (C:\Users\Windows 8.1\AppData\Roaming\npm\node_modules\stream-adventure\node_modules\adventure\index.js:131:14) at Object. (C:\Users\Windows 8.1\AppData\Roaming\npm\node_modules\stream-adventure\bin\cmd.js:18:6) at Module._compile (module.js:413:34) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Function.Module.runMain (module.js:447:10) at startup (node.js:142:18)

Jim-MK avatar Mar 27 '16 08:03 Jim-MK

node do not detect that you are running code inside tty.

When Node.js detects that it is being run inside a TTY context, then process.stdin will be a tty.ReadStream instance and process.stdout will be a tty.WriteStream instance. The preferred way to check if Node.js is being run in a TTY context is to check process.stdout.isTTY:

$ node -p -e "Boolean(process.stdout.isTTY)"
true
$ node -p -e "Boolean(process.stdout.isTTY)" | cat
false

if result is false, try to use cmd to start.

denghongcai avatar Mar 28 '16 02:03 denghongcai

ths i try $ node -p -e "Boolean(process.stdout.isTTY)" return fasle so i use cmd to start it success

Jim-MK avatar Mar 28 '16 15:03 Jim-MK

@xxnatc @Jim-MK Can you confirm if this was solved in recent node versions?

ccarruitero avatar May 30 '20 18:05 ccarruitero