Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xxnatc opened this issue Jan 20, 2016 · 4 comments
Open

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

xxnatc opened this issue Jan 20, 2016 · 4 comments

Comments

@xxnatc
Copy link

xxnatc commented Jan 20, 2016

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.

@Jim-MK
Copy link

Jim-MK commented Mar 27, 2016

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)

@denghongcai
Copy link

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.

@Jim-MK
Copy link

Jim-MK commented Mar 28, 2016

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

@ccarruitero
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants