Node.js Cygwin not supported Node.js Cygwin not supported node.js node.js

Node.js Cygwin not supported


Node in my experience runs fine in cygwin, what Node usually has EINVAL errors in seems to be MINTTY which is a terminal emulation 'skin' that is default to cygwin. I still am not sure why these EINVAL errors happen 100% but the following are the steps and tricks I use to get node working.

In my /cygwin/home/{username}/.bashrc I add node to path so cygwin can find it

export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"

If you run a 32 bit version of node:

export PATH=$PATH:"/cygdrive/c/Program Files (x86)/nodejs/"

Then to make npm run without windows to linux issues I launch cygwin in admin mode then run:

dos2unix '/cygdrive/c/Program Files/nodejs/npm'

At this point running files and most npm packages will run in MINTTY just fine, although every once and awhile you will run into EINVAL issues with certain npm packages as karma. Also you will not be able to run the interpreter directly in MINTTY, anytime I want to do these things I run:

cygstart /bin/bash

This will open a native cygwin bash.exe window, from here you run the interpreter or an any troubling package command that results in a EINVAL. It slightly sucks you have to do this but I rarely use this day to day, and I love MINTTY too much to not use it.

Also note that you can run any one line node code in MINTTY by just running something like:

node -e "console.log('hello node')"


As a simpler derivative of troy's answer for those just looking to install NPM packages:

  1. Install Node.js with the Windows installer package.
  2. Add it to the PATH with export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/" (obviously replacing the path to Node.js's installation directory with where you installed it).
  3. There's a current bug in the Windows version that can be fixed by running mkdir -p ~/AppData/Roaming/npm. This is a bug for all of Windows and not just Cygwin. At some point of the future, you won't have to do this anymore, but the command shouldn't have any negative side effects.
  4. Test it. Eg, npm install pretty-diff -g.
  5. In order to be able to run the newly installed software, you'll need to add the install locations to your PATH. You can find these with npm bin -g and npm bin (the -g flag is the "global" installation location).

Not really anything special that you have to do to get it to run in Cygwin (although I can't say if everything works).


Use Console2, it allows you to run create tabs of CLI shells. It seems running cygwin inside console2 allows me to use node REPL just fine. I have no idea why :P

Follow this guide to add cygwin to console2:
http://blog.msbbc.co.uk/2009/11/configuring-console-2-and-bash-with.html