How do I get colorized highlighting on the output?
e.g
npm start
npm test
etc.
System:
Windows 10
Git version 2.16.1.windows.4
Node 5.6.0
Uninstall Git Bash for Windows 10 and run the installer again:
Test if it works correctly:
ls
you'll see all folder colored in blueecho -e "\033[44m\033[37m Test \033[0m"
you'll se the text Test with a blue background as seen in the screenshot belowWindows 10 Console support 24-bit color and ANSI escape sequences
The terminal was a MinTTY, which does not support colors it seems. Fixed it by re-installing and ticking of Windows Terminal.
For me, it was choosing Windows default console window instead of MinTTY that made color output not working.
My solution:
git bash
; during installing, choose MinTTY (the default option).C:\Program Files\Git\etc
, open your git bashvim ~/.bashrc
(for some reason using an editor doesn't work; I guess it's a privilege issue)# Add colors to 'ls'
change it to
alias ls='ls --color=auto'
Then restart and it should work.
My version: git version 2.24.1.windows.2
winpty
Windows Git Bash has some documented quirks: Winpty and Git Bash
$ winpty npm start
winpty: error: cannot start 'npm': Not found in PATH
Again another windows / git bash quirk, it doesn't attempt to resolve executables ending in .cmd
so it needs a nudge.
$ winpty npm.cmd start
The same applies for yarn
with:
winpty yarn.cmd start
While we are here and you are having trouble getting gyp
to locate your Python2 install location to compile native extensions then try this:
env PYTHON=/c/Python27/ winpty yarn.cmd install
Git Bash overrides your PYTHON
environment variable for only the duration of this command. You get winpty
to run the pseudo-tty session to allow animation rendering and coloring.
Assuming your python 2 install location is C:\Python27
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With