Up until some weeks ago, the only way to run NodeJs on Windows were to download it from the Git repo and compile it using CygWin (another case of get the bananas AND get the monkey).
Building node.js on Cygwin (Windows)
How to install Node.js on Windows
But now there is an alternative: NodeJs team has published a Windows pre-compiled version (0.5.4 and 0.5.5):
http://nodejs.org/#download
http://nodejs.org/dist/
http://nodejs.org/dist/v0.5.4/node.exe
http://nodejs.org/dist/v0.5.5/node.exe
(there is a new version http://nodejs.org/dist/v0.5.5/node-186364e.exe)
I’m using the 0.5.4. Let’s run a simple demo that use Socket.IO:
The Socket.IO module is missing. npm is the “standard” package manager for NodeJs, but there is no Windows version yet:
So, you can download the module and its dependencies. See:
Node.js on Windows: Who Needs NPM?
Where are the URLs of the dependencies repos? You can look at
I downloaded some modules, this is my current setup:
These are subdirectories of the directory where node.exe resides. The key file to read in each module is its Package.json. This is the manifest of Socket.IO:
{ "name": "socket.io" , "version": "0.7.9" , "description": "Real-time apps made cross-browser & easy with a WebSocket-like API" , "homepage": "http://socket.io" , "keywords": ["websocket", "socket", "realtime", "socket.io", "comet", "ajax"] , "author": "Guillermo Rauch <guillermo@learnboost.com>" , "contributors": [ { "name": "Guillermo Rauch", "email": "rauchg@gmail.com" } , { "name": "Arnout Kazemier", "email": "info@3rd-eden.com" } , { "name": "Vladimir Dronnikov", "email": "dronnikov@gmail.com" } ] , "repository":{ "type": "git" , "url": "https://github.com/LearnBoost/Socket.IO-node.git" } , "dependencies": { "socket.io-client": "0.7.9" , "policyfile": "0.0.4" , "redis": "0.6.6" } , "devDependencies": { "expresso": "0.7.7" , "should": "0.0.4" , "assertvanish": "0.0.3-1" } , "main": "index" , "engines": { "node": ">= 0.4.0" } }When I had all the modules, I set the NODE_PATH variable and ran the app again:
Triumph of mind over matter! 😉 This was my first way. But the recommended alternative is to put all the modules in a node_modules subdirectory:
In this way, you don’t need the NODE_PATH environment variable. I’m using NODE_PATH because I have my own modules under development in other directories. But if you have a node_modules subdirectory, NodeJs (>0.5 I guess) looks in that subdirectory for modules AND in NODE_PATH. Then I can use NODE_PATH=c:\Git where my AjFabriq module is under development. NodeJs will find Socket.IO in its node_modules subfolder, and my AjFabriq in c:\Git\ajfabriq.
If you have problems with dependencies, read @cibrax post:
Running the “Express” web development framework on Node for Windows
There is a Python clone of npm to install NodeJs packages.
There is a way to run NodeJs from IIS. Check @shanselman post:
Installing and Running node.js applications within IIS on Windows – Are you mad?
An interesting alternative in ASP.NET:
Well, and if you want to run NodeJs on Azure? Oh! I would like to write a post about that topic, but @ntotten have stolen my idea ;-). Read:
Other posts about NodeJs and Azure:
Node.js, Ruby, and Python in Windows Azure: A Look at What’s Possible | MIX11 | Channel 9
http://channel9.msdn.com/Events/MIX/MIX11Node.js, Ruby, and Python in Windows Azure: MIX Talk
http://blog.smarx.com/posts/node-js-ruby-and-python-in-windows-azure-my-mix-talkRelated posts about NodeJs:
Node.Js: Links, news, Resources (2)
Node.Js: Links, news, Resources (1)
Playing with Node.js, Ubuntu, Sqlite3 and node-Sqlite
My links:
http://www.delicious.com/ajlopez/nodejs
More playing with NodeJs is coming.
Keep tuned!
Angel “Java” Lopez
http://www.ajlopez.com
Wonder how they’ll get around npm packages which need a compiler (such as jsdom dependencies)
Thank you very much! I’ll be testing this now! Will report back when I hit some problems! ^_^
To confirm my previous comment, I’ve made this 2MB package of NodeJS+MySQL+SocketIO for quick setup. Thank you once again for this very helpful post! http://j.mp/prB1Gm
Pingback: istoryahi.me » Node.JS Quick Setup
Pingback: AjFabriq on NodeJs (Part 2) A local Simple Application « Angel “Java” Lopez on Blog
Pingback: AjFabriq en NodeJs (Parte 2) Una aplicación local simple - Angel "Java" Lopez
Pingback: Pie in the Sky (September 23, 2011) - MSDN Blogs
Would you be interested in writing a commissioned article about Node.js on Windows Azure; approx. please contact me if you’re interested.