Scott Hanselman

WebMatrix and node.js: The easiest way to get started with node on Windows

September 16, '11 Comments [24] Posted in IIS | nodejs | WebMatrix
Sponsored By

Tomasz Janczuk and Steve Sanderson are having entirely too much fun. I posted just two weeks ago on Installing and Running node.js applications within IIS on Windows - Are you mad? when Tomasz and the team got node.js running rather nicely under IIS. Now they've got a nice little development environment in WebMatrix.

Cats and Dogs, living together, mass hysteria

Then, Steve and Tomasz decide to share clever thing with us. Well, let me just show you. Remember, this is all in-progress goofing around v0.5 stuff at best but the concepts are sound.

node.js inside WebMatrix. You may start freaking out now.

And then:

Node.js Express Site1 - Microsoft WebMatrix (76)

Hit Run:

Node.js Express Site running on Windows

How can you use WebMatrix to develop node.js applications yourself? With these easy steps:

Isn't it lovely when LEGO pieces snap together so nicely?

Enjoy, Dear Reader.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Friday, September 16, 2011 2:33:02 AM UTC
The incubator effect of Webmatrix has been a result I could not foresee (at least not to this level). This node.js implementation into webmatrix looks more elegant than I want to admit. Also, keep up the frequency Scott, you are killing it lately.
Friday, September 16, 2011 3:07:51 AM UTC
Neat.
Friday, September 16, 2011 6:11:33 AM UTC
Of course the easiest way to install node.js and keep it up to date is via Chocolatey. You can find it at Chocolatey.org.

Chcolatey is based on nuget BTW ;-)
Friday, September 16, 2011 11:59:11 AM UTC
love the ghost busters reference
you're posts lately have been great

thanks for everything!
sean m
Friday, September 16, 2011 1:56:02 PM UTC
I love Legos! Now, can Steve and his friends make me a Lego Star Wars Super Star Destroyer with Node, knockout.js, and a herring?
Friday, September 16, 2011 2:38:07 PM UTC
This is post is the best thing that has ever happend to me, I have been so interested in node but did not know how to start.
themrk
Friday, September 16, 2011 2:46:09 PM UTC
Perhaps the next big step in WebMatrix love ... using it as a front end to the RailsInstaller.org package? And more than just 'opening a site from folder' ... things like syntax love, acknowledgement of the local web server, open source app integration, and getting a WebMatrix workflow hug around working with a Rails app. Would love to see that happen; heck would love to be a part of making it happen. I just don't know where to start but I know the two would be awesome together.
Friday, September 16, 2011 4:16:31 PM UTC
I've never seriously used WebMatrix so this might have an obvious answer, but is there any hope of using something like Chirpy or Mindtouch's Web Workbench with it? That would allow you to write your node app in Coffeescript, which makes this even more interesting.
Friday, September 16, 2011 7:28:16 PM UTC
What text editor is that?
Ryan
Friday, September 16, 2011 7:34:28 PM UTC
So it's something called web matrix but I wish there was a Vim for Windows that looked like that. Super nice.
Ryan
Friday, September 16, 2011 7:38:58 PM UTC
Just a couple of things,

Love your blog!

Respectfully, EvilKiru :-)
EvilKiru
Friday, September 16, 2011 8:34:22 PM UTC
Truly mad scientist evil...

I got my existing node.js project running in WebMatrix, but there are a few gotchas I think you should enumerate, in particular with regards to modules and ports.

1. Modules can be downloaded off of github and installed in the node_modules directory of the website. No need for NPM.
2. Socket.io works!
3. Modules have dependencies, which downloading off of github doesn't get you. So don't forget to also download those dependencies. Modules can have their own node_modules subdirectory.
4. WebMatrix sets its own port in IIS Express, so your server/app should reuse that port.

The Express project template was extremely helpful.
Saturday, September 17, 2011 3:26:32 PM UTC
While this is certainly cool, I still don't entirely get the point. WebMatrix is an average (at best) IDE and the node hooks only seem to be saving you from typing 'node myapp.js' in a terminal.

I'm a VS-loving Windows dev by day (and sometimes by night) and quite like WebMatrix/WebPages/whatever the hell it's called. But IMHO the easiest way to get node running 'on Windows' is to spin up a Linux VM. npm alone is worth the effort.
Sunday, September 18, 2011 5:47:47 PM UTC
Hanselman is a good guy but he is also selling books relating to Microsoft technology such as ASP.NET something or other and does speaking engagements. In these Node.js writeups, this is obviously a way to distract Microsoft devs from wanting to bail and move to Linux because of the shiny new Node.
Monday, September 19, 2011 5:36:41 PM UTC
Sebring - Actually, we want folks to use Windows. Doesn't matter if they use node or ASP.NET.
Wednesday, September 21, 2011 4:46:34 AM UTC
@scott re sebring: well played...

i installed everything in the simple list, but it is unable to launch node.

does this setup co-exist well with IIS installed? I know little about IIS Express, so...
Thursday, September 22, 2011 11:13:10 PM UTC
Looks great, but how do I debug my code? I can't see anywhere the errors node gives me...only a 500 error.
ggg
Sunday, October 16, 2011 2:02:11 PM UTC
just don't get it - I'm missing two of the most critical elements for a proper development environment:
1. a debugger. with iisnode the only debugger i've managed to use with node os far (node-inspecrot) is unusable.
2. code completion, of if you like - IntelliSense

without these I fill like developing with emacs in 1995 coding in C and debugging with printfs...
Sunday, October 16, 2011 7:27:31 PM UTC
Ethan - I hear you and both are being looked at. Of course, you do realize that most node - or even many rails devs code without an interactive IDE debugger or intellisense.
Wednesday, October 19, 2011 2:12:02 AM UTC
Hey scott, Really awesome blog. Really cool. I would Like to know How to do the same for Web Host which has .net 4.0 how should I install node.js in webhost.
Wednesday, November 02, 2011 7:55:48 PM UTC
I’d like to add that Helicon Tech also has set of WebMatrix templates, including Node.js template plus Ruby on Rails, Django, Sinatra, Goliath, Mojolicious and Perl.

To use this you will only need Web Platform Installer and add a custom feed into it as explained on Helicon Zoo homepage: http://www.helicontech.com/zoo/

After that you navigate to Zoo->Packages->WebMatrix Templates and install. To run application you install Node.js form to Zoo->Packages->Node.js Hosting Package. This package includes Node.js, Helicon Zoo Module for IIS and IIS Express, rippy.py to replace NPM as it does not work on Windows yet and some other useful modules. Helicon Zoo Module (unlike iisnode module mentioned in this article) runs full featured HTTP stack, so you can utilize all asynchronous functions of Node.js, including comet (long polling).

Then to publish (deploy) your web site to a Windows based hosting, this hosting should also install Node.js Hosting Package from Zoo on a remote server. Some other applications, like databases, may be also required.

Any feedback is appreciated. Thank you!
Wednesday, December 07, 2011 11:08:27 PM UTC
Ok, Hanselman, this is kind of a rebuttal / apology .NET 4.5 has some cool asynchronous methods that don't tie up threads. I'm thinking Node.js is a waste of time now at least on Windows as that was the only reason to use Node.js for me in terms of the whole idea of being able to use long polling efficiently. I am all for .NET myself and prefer that over any for web stack because of ease of use and the Microsoft IDEs rock. I still strongly think Node.js is best left in the unix/linux world as github and npm and redis and couchdb all that jazz fit well together. I'm so happy about .NET 4.5 and will be trying long polling with jQuery as I way prefer doing it in c# and sql server.
Saturday, December 10, 2011 6:49:37 AM UTC
Is there any way to use an older COM object from node?
Tuesday, December 20, 2011 2:28:20 AM UTC
Wondering why I haven't see a list like this before. Thanks for taking the time to put it together. Quality suggestions here and, because of the fact that all are free (donation ware), there is no reason not to try them out.
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.