Node command not working in git bash terminal on windows

I am trying to run the node command in my git bash terminal. When I run the node command, nothing happens when I press enter. $ disappears and it just leaves the blinking cursor on the next line without > .

 My-PC MINGW32 / $ node -v v4.5.0 My-PC MINGW32 / $ where node C:\Program Files\nodejs\node.exe My-PC MINGW32 / $ node _ 

Can someone tell me what the problem is?

Thanks!!

+6
source share
1 answer

If you do not get a new line with > after entering "node" - this is probably due to the fact that newer versions of Git Bash do not start in the TTY mode they are used to. The discussion is here . You can confirm by entering:

 node -p -e "Boolean(process.stdout.isTTY)" 

If this returns false, then the Node REPL (and some other console tools) will not work correctly.

There are several ways:

Workaround A

 winpty node 

Or you can add an alias to your .bash_profile:

 alias node="winpty node" # and for npm CLI/scripts: alias npm="winpty npm.cmd" 

Workaround B

Create a new shortcut for Git Bash with the following purpose:

 "C:\Program Files\Git\git-cmd.exe" --no-cd --command=usr/bin/bash.exe -l -i 

and use this instead of the standard git bash.

+6
source

All Articles