windows 中的 bower init 命令错误 (gitbash)
bower init command error (gitbash) in windows
当我运行在gitbash中初始化bower时,显示如下错误:
bower ENOINT Register requires an interactive shell
Additional error details: Note that you can manually force an
interactive shell with --config.interactive
运行 通过另一个终端的命令,例如 Node.js
命令提示符、Windows cmd
本身或另一个命令提示符。
问题:mintty.exe
Issue 802 确实提供了很好的解释:
I've tracked this down to an issue with mintty.exe
.
In the bower/lib/config.js
file (line 34 for bower v 1.4.1), tty.isatty(1)
returns false under mintty.exe
, but true if you run cygwin.bat
(which is bash --login -i
using the Windows terminal).
Here's a convenient way to check your terminal:
node -e "var tty=require('tty'); console.log('tty.isatty(1):' + tty.isatty(1))"
可能相关:mintty - issue #56 "Improve support for native console programs".
For those stumbling across this issue looking for a solution, the obvious quick workaround for this issue is to simply avoid using mintty.
This doesn't mean you have to return to using the Windows terminal for bash, as there are other alternatives:
- See Terminal Setup in Windows 7 and/or Replacing default git bash console with Console2 for instructions for configuring Console2 with bash.
- Turn off the menus, tool bars, and status bars,
- create a shortcut named "
Cygwin
" or "Bash
", change the shortcut's icon to C:\cygwin64\Cygwin-Terminal.ico
and you'll probably never know the difference.
P.S. If you've ever noted other issues with mintty.exe
, like msysgit not prompting for a password properly or the node repl not working, this is probably the same issue.
解决方法:
- do this from the run command
cmd.exe /C "C:\Program Files\Git\bin\bash.exe" --login -i
then bower init
will work and you can do everything in minw64, mintty, or git-bash whatever it is called.
或
If you are using windows run bower init using CMD
或
if you are using git bash follow these steps:
- Uninstall existing GIT bash
- Reinstall GIT bash
- Set up during installation:
- 3a: Select> Use Git form the Windows Command Prompt
- 3b: Select> Checkout Windows-style, commit Unix-style line endings
- 3c: Select> Use Windows' default console window
好吧,你真的不必 uninstall/reinstall,你可以只使用 Win CMD。
你 bower init 然后切换回 MinW64。
编辑找到了修复...像这样开始 git-bash
使用运行命令,稍后可以更改快捷方式
cmd.exe /C "C:\Program Files\Git\bin\bash.exe" --login -i
当我运行在gitbash中初始化bower时,显示如下错误:
bower ENOINT Register requires an interactive shell
Additional error details: Note that you can manually force an interactive shell with --config.interactive
运行 通过另一个终端的命令,例如 Node.js
命令提示符、Windows cmd
本身或另一个命令提示符。
问题:mintty.exe
Issue 802 确实提供了很好的解释:
I've tracked this down to an issue with
mintty.exe
.In the
bower/lib/config.js
file (line 34 for bower v 1.4.1),tty.isatty(1)
returns false undermintty.exe
, but true if you runcygwin.bat
(which isbash --login -i
using the Windows terminal).Here's a convenient way to check your terminal:
node -e "var tty=require('tty'); console.log('tty.isatty(1):' + tty.isatty(1))"
可能相关:mintty - issue #56 "Improve support for native console programs".
For those stumbling across this issue looking for a solution, the obvious quick workaround for this issue is to simply avoid using mintty.
This doesn't mean you have to return to using the Windows terminal for bash, as there are other alternatives:
- See Terminal Setup in Windows 7 and/or Replacing default git bash console with Console2 for instructions for configuring Console2 with bash.
- Turn off the menus, tool bars, and status bars,
- create a shortcut named "
Cygwin
" or "Bash
", change the shortcut's icon toC:\cygwin64\Cygwin-Terminal.ico
and you'll probably never know the difference.P.S. If you've ever noted other issues with
mintty.exe
, like msysgit not prompting for a password properly or the node repl not working, this is probably the same issue.
解决方法:
- do this from the run command
cmd.exe /C "C:\Program Files\Git\bin\bash.exe" --login -i
then
bower init
will work and you can do everything in minw64, mintty, or git-bash whatever it is called.
或
If you are using windows run bower init using CMD
或
if you are using git bash follow these steps:
- Uninstall existing GIT bash
- Reinstall GIT bash
- Set up during installation:
- 3a: Select> Use Git form the Windows Command Prompt
- 3b: Select> Checkout Windows-style, commit Unix-style line endings
- 3c: Select> Use Windows' default console window
好吧,你真的不必 uninstall/reinstall,你可以只使用 Win CMD。 你 bower init 然后切换回 MinW64。 编辑找到了修复...像这样开始 git-bash 使用运行命令,稍后可以更改快捷方式
cmd.exe /C "C:\Program Files\Git\bin\bash.exe" --login -i