git - Windows 中的 bower init 命令错误 (gitbash)

标签 git github bower git-bash bower-install

当我在 gitbash 中运行 bower init 时,显示以下错误:

bower ENOINT Register requires an interactive shell

Additional error details: Note that you can manually force an interactive shell with --config.interactive

最佳答案

问题: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:

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

关于git - Windows 中的 bower init 命令错误 (gitbash),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38683378/

相关文章:

git - 更新文件夹中的所有 repo 协议(protocol)?

amazon-web-services - AWS无服务器项目无法通过Git共享?

ios - 在 xCode 项目中使用 git 子模块

git - repo 同步/Git 克隆仅从 Jenkins 的奴隶失败

GitHub GUI 将文件夹从一个存储库移动到另一个存储库

node.js - 在 Ubuntu 上安装 Bower 版本 1.8.2 时出错

node.js - bower 安装: unknown encoding

git - Bower + Git 子模块 + Docker 组合

git - SourceTree 中的这些标签是什么意思?

git - 您尚未完成 merge (存在 MERGE_HEAD)