简体   繁体   中英

bower init command error (gitbash) in windows

When i run bower init in gitbash ,following error is displayed:

bower ENOINT Register requires an interactive shell

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

Issue: mintty.exe

Issue 802 does provide a good explanation:

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))"

Possibly related: 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:

PS 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.


Workarounds:

  • 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.

OR

If you are using windows run bower init using CMD

OR

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

通过另一个终端运行该命令,如Node.js命令提示符,Windows cmd本身或其他命令提示符。

well you don't really have to uninstall/reinstall, you can just use the Win CMD. do you bower init then switch back to MinW64. edit found a fix...start git-bash like this use run command, you can change the shortcut later

cmd.exe /C "C:\Program Files\Git\bin\bash.exe" --login -i

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM