Title: Setup a basic node.js Windows development environment
Slug: setup-a-basic-node-js-windows-development-environment
Date: 2013-11-25 18:57:08
Author: Kartones
Lang: en
Tags: Development, Javascript, NodeJS, Windows, Tools, systems-IT, Python
Description: A step-by-step guide on setting up a basic node.js development environment on a Windows system, including the installation of necessary tools and modules.

 <p>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.</p> <p>I'm just assuming that <strong>you</strong> <strong>already have installed Visual Studio 2013.</strong> I have the Premium Edition, I don't know if with the free Express Edition everything will work (specially node tools for VS).</p> <p> </p> <p>This are the steps to setup most basic stuff needed:</p> <p> </p> <p><strong>1) Install </strong><a href="http://nodejs.org/download/"><strong>node.js</strong></a></p> <p>I used the MSI installer x64 without any issue.</p> <p><strong></strong> </p> <p><strong>2) Install </strong><a href="http://www.python.org/download/"><strong>Pyton 2.7.x</strong></a></p> <p>Seems that 3.x is not fully supported, so I installed 2.7.6 (64-bit).</p> <p>Remember to add to the PATH environment variable it's path, it didn't on my installation and node-gyp was not working.</p> <p><strong></strong> </p> <p><strong>3) Install </strong><a href="https://github.com/TooTallNate/node-gyp"><strong>node-gyp</strong></a></p> <p>Required for modules that need building from their sources. Uses Python and under windows Visual C++ runtime builder for .node files.</p> <p><strong></strong> </p> <p><strong>4) Install </strong><a href="https://nodejstools.codeplex.com/"><strong>Node.js Tools for Visual Studio</strong></a></p> <p>Really useful, not only provides with project templates for node apps and websites, but <a href="http://www.hanselman.com/blog/IntroducingNodejsToolsForVisualStudio.aspx">also allows cool things</a> like local or remote debugging or intellisense for all code.</p> <p>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.</p> <p><strong></strong> </p> <p><strong>5) Install </strong><a href="https://github.com/remy/nodemon"><strong>nodemon</strong></a></p> <p>To avoid manually restarting node server, I'm lazy so for me a must-have </p> <p> </p> <p>Installing modules is the only painful part, but going to a Node command prompt and manually "converting" to windows .sh commands and running "<font face="Courier New">node-gyp configure build install</font>" 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.</p> <p>Oh, and if after building node-gyp fails not finding the .node "binary", go to the <font face="Courier New">\build</font> subfolder, probably VC++ created a <font face="Courier New">\build\release</font> subfolder and put it there.</p>
