Setup a basic node.js Windows development environment

Lately I'm starting to learn a bit of how node.js works, so after some fights I've finally been able to have a decent setup for development without having to rely on a remote *NIX machine running node.

I'm just assuming that you already have installed Visual Studio 2013. I have the Premium Edition, I don't know if with the free Express Edition everything will work (specially node tools for VS).

This are the steps to setup most basic stuff needed:

1) Install node.js

I used the MSI installer x64 without any issue.

2) Install Pyton 2.7.x

Seems that 3.x is not fully supported, so I installed 2.7.6 (64-bit).

Remember to add to the PATH environment variable it's path, it didn't on my installation and node-gyp was not working.

3) Install node-gyp

Required for modules that need building from their sources. Uses Python and under windows Visual C++ runtime builder for .node files.

4) Install Node.js Tools for Visual Studio

Really useful, not only provides with project templates for node apps and websites, but also allows cool things like local or remote debugging or intellisense for all code.

This VS Tools are in alpha, but the main problem you will encounter with it is that npm will fail a lot, as many modules have only been tested under Mac/Linux and use .sh scripts, that of course won't work under Windows.

5) Install nodemon

To avoid manually restarting node server, I'm lazy so for me a must-have

Installing modules is the only painful part, but going to a Node command prompt and manually "converting" to windows .sh commands and running "node-gyp configure build install" usually either works or pops out required dependencies that you should fetch manually first. It's painful but blame the module developers, seems that node and npm properly support now Windows but only some up to date modules seem to take this OS into account.

Oh, and if after building node-gyp fails not finding the .node "binary", go to the \build subfolder, probably VC++ created a \build\release subfolder and put it there.

Comments?

Posted by Kartones on 2013-11-25