Setup Node.js in Windows 10 with Cygwin Support

1. Download nvm-windows and install it. MAKE SURE that you right click nvm-setup.exe and choose Run as administrator. It is necessary that the installer run as administrator in order to create the necessary symlinks.

2. Open a Windows Powershell with adminstrator privileges. If you use ConEmu this is really easy since it is one of the pre-installed shell options.

3. In the Powershell window run nvm install latest to install the latest version of Node.js

4. Follow the information it provides after the install. It will give the command to use the latest version. As of the time of this writing the command is nvm use 15.8.0. Once again it is necessary that this command is run in an admin Powershell for the system symlink to be created.

5. Set up the following in Cygwin:

Either in your ~/.bashrc or ~/bash_aliases create the following alias.  Replace ‘myuser’ with your username:

alias nvm='/cygdrive/c/Users/myuser/AppData/Roaming/nvm/nvm.exe'

 

In ~/.bash_profile add the following code to append the environment $PATH variable:

if [ -d "/cygdrive/c/Program Files/nodejs/" ] ; then
    PATH="/cygdrive/c/Program Files/nodejs/:${PATH}"
fi

 

That’s it!

Now, open a new Cygwin BASH window and you should be able to use npm and node.

Credits/thanks:
Node.js
Node Version Manager (nvm) for Windows
docs.microsoft.com: Set up your Node.js development environment directly on Windows
docs.microsoft.com: Get started using Node.js on Windows for beginners
dev.to/skaytech: How to install Node Version Manager (NVM) for Windows 10?