Hacker News new | comments | ask | show | jobs | submit login
Porting Node to Windows With Microsoft’s Help (nodejs.org)
193 points by icey on June 23, 2011 | hide | past | web | favorite | 77 comments

This is great news, i cant upvote this enough. Ever since learning what Node is, its always excited me.

I'm only into part-time/hobby development and so havent been able to justify spending the time (or the money) to do a Unix based OS setup for this, since all my machines run Windows.

With a node executable and native Windows support, it means i can have a dabble more often, which could lead to completion of a real project, even if im only working on it part time. I think for that reason alone, it will increase adoption of Node many fold. Not that i have anything against Apache, but it might just get unseated as the hobbyist's first choice as multi-platform web server (assuming its still on the top spot. I havent used it in ages).

I just hope it doesnt get restricted to the Windows Server family of OSes. I did a quick dig, and can see Windows 7 supports IOCP, so i'm hopeful.

IOCP has been in Windows since NT4, including all of the non-Server SKUs - from what I can tell, Win2k3+ is officially supported which means it will almost certainly work on >= XP. It's kind of funny to hear all the web folks talk about this "new cool IOCP API" :)

If you do want to see a new cool API that Node.js should eventually take advantage of, check out User-Mode Scheduling in Win7+ at http://msdn.microsoft.com/en-us/library/dd627187(VS.85).aspx ; you can schedule your own async IO threads in userspace and save on kernel transitions.

Great find. Thank you

Ubuntu: free. VirtualBox for Windows: free. Even 512 MB virtual RAM for the VM should be sufficient for Ubuntu 10.10 to get you started. No need to wait! =)

(I've meanwhile reversed my setup to reflect the majority of my dev work: physically installed Ubuntu, virtualized Windows.)

thanks. that is something i did have setup. its a very useful stop-gap solution. but at some point one does inevitably have to work with the platform itself, and in all fairness, i just feel 'safer' in Windows. simply because its quite the learning curve to learn development but then to learn about a new OS adds to that.

I do see what you are saying though, and its ideal for someone that isnt as unfamiliar as i

Since graduating a year ago, I seem to have turned into a Windows guy, simply because I use it all day at work.

Having a reflective moment a couple of weeks ago, I decided to learn something completely different (for me) and try Ruby. Not wanting to become type-cast as a Windows guy, I chose to do it on a unix based system. For this, I use an Ubuntu image in Virtual Box, and have been very happy.

> I just feel 'safer' in Windows.

I guess I could say I'm the same, though I think its more down to simply preferring Windows 7's UI/UX over the likes of Gnome and KDE. I've also tried customising a whole variety Linux window mangers, but always gave up.

So what I'm doing now is using Virtual Box in headless mode, then ssh-ing in with X-forwarding enabled. This gives me new icons in Windows 7's task bar for every 'remote' Linux window I have open. (though really I don't use much more than a terminal and maybe gvim). To an observer looking over my shoulder, it would just appear that the 'remote' Linux applications are native Windows programs.

[edit] I didn't really address your point about the learning curve to learning a new OS. This is valid issue and all I can suggest is to give it a try, and using a VM is an easy way to just dip in. You can get pre-installed Virtual Box images for many Linux distros such that it is really easy to get started. Unfortunately, my set-up took quite a bit of effort to get started (even with my familiarity with unix), but using a full-screen Linux VM is a good place to get started.

I guess what I was describing is just where you can go with it once you're comfortable.

it's true that setting up node on windows is just a minor convenience (i did it with both ubuntu on virtualbox and with cygwin). it's still a big gap for novice programmers, and severely limits the number of windows users who just want to try it. having a native version for windows will increase adoption a lot.

Ooh, node on Azure. Finally a good excuse for a .Net guy like myself to finally play around with Node.

This doesn't surprise me, but it does amaze me. What was stopping you from playing around with Node before? I know that comes off as flippant, but I'm genuinely interested in understanding this self-imposed limit on learning.

I'm speculating, but...Barrier to entry? If you're not familiar with the UNIX stack then getting up to speed on that just to play with node might not seem like a great idea (especially if you don't have a lot of spare time) or lack of applicability? It can often be really frustrating to get up to speed on something you know you're never going to be allowed to use in your current job. Some places are MS-or-the-highway shops...

Basically, what josephcooney said. It would take some time for me to become familiar enough with UNIX before I could really play around with it. There are plenty of new things and shiny objects in the .Net world to keep a developer busy and sometimes its hard to justify the time when I know I couldn't use it right away.

And for what its worth, I'm actually working full time at my startup which is based on .Net and running on Azure. :)

Edit - Btw I enjoyed your thoughts on this post: http://www.openmymind.net/2011/5/3/Dealing-with-Now-and-why-...

I got node.js to work on Windows XP via Cygwin about 4 or 5 months ago. Here are some useful links:

- Building node.js on Cygwin (be sure to RTFM regarding which version to build). https://github.com/ry/node/wiki/Building-node.js-on-Cygwin-(...

- helpful comments on StackOverflow - in particular running the obscure ash.exe and doing rebaseall seemed to help http://stackoverflow.com/questions/3360948/compiling-node-js...

- self-contained windows binaries of nodejs - I did't try this, but seems like it could save some headaches http://node-js.prcn.co.cc/

I wish I could up vote you, but Cygwin prevents me. Imagine a world where all of the cool software was written on Windows, and the Linux folks had to be happy using Wine to run it at all. That situation would suck; that's how I feel when someone from the Linux side says "it compiles on Windows with Cygwin" as if that's some kind of achievement or favor.

> Imagine a world where all of the cool software was written on Windows, and the Linux folks had to be happy using Wine to run it at all.

Is this a joke? It sounds like it could be, but if it is, I can't tell.

That was the world before ~2005. The use of Windows has always been predicated on the notion that for-pay software is the default, and that, as a business model it is desirable. Linux has always been the opposite. Thus, as Linux users, we get the attention of open source developers -- usually people who are developing things about which they are passionate. We also have to suffer through version <1.0 (often, <<1.0).

The "cool" software, much of it, is still Windows only (or maybe Windows and Mac). The Gimp and Inkscape are pale imitations of Photoshop and Illustrator. Video editing that is as good as Premiere or Final Cut? Forget about it. And forget about modern gaming too.

All of that has to be run with Wine, if it can be run at all.

Driver support is minimal as well -- Nvidia only last week released a beta driver which begins to address bugs which arise in Gnome 3, while introducing new ones. Imagine if that were the case with Windows: your graphics driver did not operate properly with your desktop shell and you have to wait for a new driver.

So be happy that you have Cygwin, which can almost perfectly implement a Linux environment. Wine only occasionally runs a program well enough to be usable.

I think by "cool software" politician meant "cool dev tools". When you're a hacker, it's easy to get them confused, and it does seem like a lot of cool tools are Unix only. Go comes to mind; it was basically Unix-only at first, if it isn't still.

Actually yes, I did mean cool dev tools. Sorry if that was unclear. However, I don't think Photoshop is a good counter-example since OSX has top-tier graphics applications AND runs on Linux.

> I don't think Photoshop is a good counter-example since OSX has top-tier graphics applications AND runs on Linux.

No, OSX runs on the Darwin kernel, not Linux. For a number of reasons, you can't take an app designed for OSX and run it on a laptop using Ubuntu (or another Linux distro).

To be fair, it would be rather trivial to port the upper levels of OSX to any other Unix-like OS. Darwin exposes a very BSD-like interface to applications.

Apple considered, for some time, replacing classic MacOS with Linux (I have used Apple's MkLinux a lot).

Thanks, you're right. I should have checked my facts before saying that.

> as if that's some kind of achievement or favor.

Every piece of free software we run (that we didn't write) is a favor. It's built by people generous enough to share what they did and shared so the same generous people could cooperate and build upon rhat other generous people did before them. No free license prevents such software from running on Windows and none ever will. If you feel like porting, you will be welcome.

The fact there is really no need to do it, however, because most of it runs perfectly well under Cygwin, remains.

I haven't seen anything about the POSIX subsystem that should be in Windows. It seems to me it could be used to build a more Windows-ish Cygwin.

Also, never forget Cygwin is the work of very generous people who wanted Windows users to have a free Unix-like environment they could use to run code that would be very painful to compile under Windows otherwise.

I know that all you've said is true, and I agree with it. Open software is a blessing, built by generous people. If other people want certain features, they are welcome to contribute patches. I want you to know that I agree with this, I've never disagreed with that.

I'm arguing on behalf of a simple hypothesis, that Windows users know Windows and do not know Linux/Unix or POSIX. Moreover, they may not want or may not have the time to learn Linux/Unix or POSIX subsystem. They do not know nor can take advantage of what a "free Unix-like environment" provides. They know what they know. Cygwin adds a heavy emulation layer into Windows which they do not know. To be clear, they do know JavaScript and they do understand what running JavaScript on the server means.

Is Cygwin a technological achievement in and of itself? Yes, absolutely. Is Wine? Yes, absolutely. Is ability to run node.js or git on Windows through Cygwin? Yes, absolutely. Is that an awesome hack (in the best sense of the word) for people that understand the Cygwin emulation layer? Yes, absolutely. Is it an achievement for Windows-only developers and users who don't understand -nix idioms or POSIX subsytem? No, it isn't.

That's all I'm saying. I'm not offering a better solution -- I don't have one. I'm just saying that when someone from the -nix side says that something runs on Cygwin that they should respect and empathize with what that means for Windows users operationally.

To use an analogy, earlier a youtube video was posted about a first encounter between a tribe in Papua New Guinea and some white travelers. The white people had amazing tools are artifacts -- mirrors, matches, plastic cups, knives, etc -- which the tribal peoples had never seen before nor had a framework of understanding within which to reason about them. Are the tools cool? Yes -- the knife whittled wood far more effectively than their crude tools. Are the tools scary and hard to understand? Yes -- the tribesman covered the mirror with a leaf (!) because he couldn't understand how it worked or if it was (presumably) some sort of magic. The *nix command-line/file-system/permissions apparatus is incomprehensible magic voodoo to someone who's only had Windows console experience their entire life. So for the "white man" to say "but it runs in Cygwin" to the primitive native peoples is perhaps a tad presumptive. That's not to say that the native peoples are lesser beings intellectually viz. "don't eat that poisonous flower", Windows has had IOCP since NT4.

I think it's a wonderful example of the way the process should work that Microsoft is stepping up to help Ryan/Joyent port node.js to idiomatic Windows.

The target audience for node.js is not a group of primitives who cannot understand how a mirror work. There are very smart developers that live their entire lives in the comfortable dictatorship (as in "Microsoft dictates what you'll use") that Windows development is. The audience is sophisticated enough to run node under Cygwin, to compile it from sources if needed. They may have to read something or get used to invoking a compiler from a terminal, but that's nothing a developer cannot master in 2 hours.

What Microsoft is doing here is preventing the deployment of a non-Windows servers to run node.js workloads because it also runs on Windows, much like what the PR they did with the PHP folks when they made sure PHP ran fine on IIS or, earlier, when Microsoft acquired Sofrimage only to validate Windows NT as a competitor to IRIX. Don't expect any commitment from Microsoft to the node.js community or any continued investment after they reach the goal of diverting enough resources into this port.

And, finally, Microsoft is not stepping up to help Ryan and Joyent. Microsoft is stepping up to prevent Ryan and Joyent to disrupt, in any measure, the Windows ecosystem.

My point was more to show that it can be done if people just want to play around with node.js on windows until it becomes a more first class tool. Not a plug particularly for Cygwin, though it sure beats MS-DOS.

I know, and I am glad you managed to get /something/ working because node.js is that cool. In fact, I've been working with it on my Mac and on Joyent's node cloud, but while Cygwin provides a passable experience for Linux hackers stuck on Windows, in my humble opinion it's not a passable experience for Windows hackers that want to use all of the cool dev tools that constantly spring up "over there".

Sorry about your bad experience. I run cygwin okay (not everything works, for example pip doesn't work), and nodejs dev in cygwin has been very pleasant for me so far.

(Node.js Windows server side) + (HTML5 + javascript + CSS on Windows 8 native ) == really really interesting

Nice. The first time I heard a node.js talk my first thought was, "shouldn't be too bad to implement with IOCPs". Glad to see it happening.

Surprised that Microsoft would support V8 as a server side JavaScript engine instead of doing something with Chakra.

That wouldn't get them a share of the momentum and mindshare that node.js currently has.

Perhaps they'll help get it working as-is, then help with a project to make the framework more engine agnostic, then move over to using theirs instead of V8.

The cynic would suggest that "extinguish" comes next, though I can't see that working for them in this case in this day so maybe they'll be sensible/good enough not to try that one...

I think it would be hard to make it agnostic with all the library code that will be available. All the js packages that are being written for node are written to work with the the feature set and bugs of V8. If there's a V8 node on windows there will be no reason to use a version with any other engine as you wouldn't know what it could be breaking.

Microsoft are effectively ceding server site JavaScript on windows to Google's JavaScript engine without a fight.

There has been talk in the past (from the guy that was in charge and the company that now funds his work on the project) about being more engine agnostic. But it was referred to as a "far future" goal as there were plans for a great many things that were considered more important and useful. So it isn't something that has not been (or will not be) considered.

On MS's past form, I doubt they will cede server-side JS to Google's engine permanently. They have money to throw at people to throw at making their engine and node work together, if they so desire.

Would be nice if MS made a decent javascript engine that embeddable in my own project,like V8, kinda like JScript was that is no more.

I would love to use javascript as a scripting language for my .Net programs, and I can't use the one MS built for IE, instead I need to go with less than complete codeplex projects.

Check out Jint, Jurassic and IronJS; all 3 are JavaScript implementations on the .Net framework. Jurassic compiles to CLR, Jint is interpreted and IronJS runs on the DLR.

SpiderNode to the rescue?

Embrace, extend, extinguish.

What was the last thing Microsoft successfully "extinguished"?

That doesn't mean that it isn't still their modus operandi.

That only says something about the results, not about what they tried.

What worries me is that lots of Node.js code may get developed on Windows and be unable to run on other implementations. I have seen Windows-only Java code. I know it can be done.

And it always seems a waste, for it already should run fine under Cygwin, much closer to the original implementation.

FUD goes both ways.

thats great, funnily enough loving working with node, is one of the things that pushed me over the edge and made me buy a mackbook pro, sick of having to deal with cygwin on windows. but this is good news, albeit too late for me.

Out of curiosity, what's wrong with cygwin? I'm not a big Node guy, but I run it on cygwin for the sake of CoffeeScript and I've written a few small Node apps as well. Hasn't been even slightly painful.

Not fast, ugly, bad integration in the OS, often outdated, bad package manager. Well, still better than not having a Unix prompt I guess.

The minTTY terminal helps a lot. Windows console is, indeed, a horrid environment.

Agreed about Windows console - I use http://sourceforge.net/projects/console/.

Try Power Shell.

PowerShell is handy, but man, is it slow. If you thought text rendering by cmd.exe was slow, wait till you get a load of PowerShell.

I don't really understand why the console subsystem in Windows is so slow that it can actually add a significant amount of time to a build with lots of scrolling text.

Even the "slow" Terminal.app is a whiz by comparison, to say nothing of Gnome Terminal, or, rxvt.

I remember a few occasions at work where I figured I'd write a quick Powershell script to process some text files or something, and writing the script was quick and pleasant enough, but then it turned out to be quicker to just write a C# program to do the same thing rather than wait for the Powershell script to finish =)

> it turned out to be quicker to just write a C# program

I you really should install cygwin (and MinTTY).


iirc I had cygwin installed as well, but had mostly stopped using it for some reason I forget.

... which runs in the standard console, and therefore does nothing whatever to address the problem with the Windows console being awful.

It adds a bunch of useful stuff to the Path including select, sort, and ls. The lack of utilities in the standard cmd is my major gripe, what's yours?

You were responding to someone's complaint about the lousy console window.

The emulator itself is absolutely terrible, compared to, say, gnome-terminal or iTerm.

PoSH 2+ includes tabs and a method browser IIRC.

pretty much, compared to an integrated terminal like *nix, im a big fan of things "just working"

I consistently prefer running a Linux terminal in a virtual machine to running Cygwin natively. And it is faster, too.

This is my preferred unix-in-windows setup as well. Free VMWare player and your favorite distro of linux and you're good to go.

I did a lot of work under cygwin when I had a corporate issued notebook and corporate policies were (at the time) very Windows-friendly (and anything-else-hostile). It made Windows into a bearable experience for a Unix guy.

A plethora of compilers, interpreters, tools, toys...

It's slow, true, but for development, how fast you need it to be?

And there is an advantage (I will regret saying this) in hardware support. You can use a broader selection of hardware with Windows than you can on Linux. Windows can be brain-dead from time to time (it insisted on rotating my notebook screen when I unplugged the rotated LCD) and I never got that Dell to suspend or hibernate to my satisfaction, but, with Cygwin, it's the next best thing after OSX. The first option for developing stuff that won't run on Windows is, of course, a real Unix (the kind that runs X).

broken paths, broken experience - need to constantly nuke npm caches. I finally got it working but it's tacky.

Instead of trying to fight Cygwin just use a VirtualBox install of a linux flavor.

If you're deploying to a Linux box it makes even more sense.

Now tell me they're writing a SQL Server driver, and I'll be very interested...

I believe there is already some sort of driver . https://github.com/orenmazor/node-tds

Haven't tested it, and it's no ORM, but it's something.

I highly doubt that they are, but I wouldn't put it past anyone from the community to have one shortly after Node for Windows is released.

Microsoft wrote an SQL Server driver for PHP as part of their push over the last few years to get people using PHP on Windows: http://sqlsrvphp.codeplex.com/. I suspect they'll do the same for Node, if they're serious about this.

This is great news - although I'm more than happy using it on linux, it will help adoption by being "officially" supporting windows.

Overblown .net developer panic in 3...2...1...

I can't wait ... we routinely have a quarter million concurrent users hitting our servers, node.js could let us do lots of cool stuff.

What? I'm excited! :)

Me too! I've still yet to meet a real live .net dev who is actually panicking.

From what I've seen, the .NET community is actually really excited, as are a lot of MS folks (myself included!)

I believe Parent is making fun of the overreaction to the Silverlight and Windows 8 news.

That overreaction was one of the funniest things I've read online in some time.

I am not panicing, just resolved that MS is probably deprecating .Net, it's obvious by the messages they are sending.

Hell they can't even settle on a single UI technology, .Net has 3 right now, looks like a 4th coming in Win8.

Don't get me started :-/

Open Source Node.js on Windows using IOCP = great

M$ involved in any way with Joyent and/or Node.js = really bad idea

Why the downvotes? Just for the knee-jerk 'M$' maybe?

Node on Windows is great, or at least kinda cool, but the direct involvement of Microsoft in 'embracing' disruptive upstart technologies has, historically, been a decidedly not-great thing for said technologies.

Why on earth would one assume things will be different this time around?

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact