我正在尝试在我的git bash终端中运行node
命令。当我运行node
命令时,按Enter键时没有任何反应。 $
消失,它只是在没有>
的下一行留下一个闪烁的光标。
My-PC MINGW32 /
$ node -v
v4.5.0
My-PC MINGW32 /
$ where node
C:\Program Files\nodejs\node.exe
My-PC MINGW32 /
$ node
_
有人能告诉我这个问题是什么吗?
谢谢!!
如果您在输入“node”后没有获得带有>
的新行 - 这可能是因为较新版本的Git Bash不能在以前的TTY模式下运行。 Discussion here。您可以通过输入以下内容进
node -p -e "Boolean(process.stdout.isTTY)"
如果返回false - 那么Node REPL(以及其他一些控制台工具)将无法正常工作。
有几种解决方法:
winpty node
或者您可以在.bash_profile中添加别名:
alias node="winpty node"
# and for npm CLI/scripts:
alias npm="winpty npm.cmd"
使用以下目标创建Git Bash的新快捷方式:
"C:\Program Files\Git\git-cmd.exe" --no-cd --command=usr/bin/bash.exe -l -i
并使用它而不是默认的Git Bash。