loading...

Quick-Fixing the Windows command line for JavaScript development

terabaud profile image Lea Rosema Updated on ・1 min read

A major issue with using Windows for web development is the lack of a nice unix-like shell environment. Although most of the JavaScript NPM tooling also works with PowerShell or CMD, I have experienced some weird Command not found issues when working with some packages on a drive other than C:\.

An easy fix for that is to just use the bash shell that comes with git. It's more lightweight than installing a complete Linux/msys2/cygwin distribution and it suffices for most JavaScript development purposes.

I like to use the git bash in combination with hyper.is for a nice terminal experience. Just configure the shell setting to
'C:\\Program Files\\Git\\bin\\bash.exe'. I'm using a darker version of rebeccapurple as the background color (#221133) 💁.

Hyper terminal featuring git bash on Windows

If you are using vscode, you can adjust your integrated shell via settings.json accordingly:

{
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    ...
}

Posted on Feb 17 by:

terabaud profile

Lea Rosema

@terabaud

Product Engineer by day, creative coder by night. Working at SinnerSchrader.

Discussion

markdown guide
 

That's not a "fix", that's a workaround - and not even a good one, since the bash (BTW, Windows 10 has a native one, you don't have to use the Git port for it...) breaks most people's workflows with their weird path formats.

So your actual problem remains unsolved which is sad.

(I suspect an incomplete %PATH%...)

 

Using the git bash works for me. So, my actual problem with incompatibilities alongside with the CMD or PowerShell command line is actually solved :).

Also, everything in %PATH% like the node.exe and stuff are available in the git bash.

Installing the native bash on Windows 10 is also a solution. But it involves installing Windows Subsystem for Linux and a Linux distribution (see: docs.microsoft.com/en-us/windows/w...).

 

Thanks for sharing this.

I would like to add that Cmder with git for windows is another good alternative for this kind of issues. I used it for a year and was quite happy with it.