DEV Community

Lea Rosema (she/her)
Lea Rosema (she/her)

Posted on • Updated on

Quick-Fixing the Windows command line for JavaScript development

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",
    ...
}

Discussion (3)

Collapse
tux0r profile image
tux0r

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%...)

Collapse
learosema profile image
Lea Rosema (she/her) Author

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

Collapse
vonheikemen profile image
Heiker

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.