Getting started with node.js on Windows

The title is somewhat misleading. As of right now, node.js doesn’t run on Windows. You have to run it on some kind of *nix/BSD based system. But there is a somewhat low footprint way to run it and play around with it on your Windows box.

Step 1 – Download and install VirtualBox orVMWare Player. I chose VirtualBox. It’s free, and supports 64-bit guests.

Step 2 – Download The Turnkey Linux core appliance and unzip it somewhere. This handy little virtual machine is based on Ubuntu and give you a basic command line environment with networking.

Step 3 – Import the Turnkey core appliance into VirtualBox.

turnkey_step_1

turnkey_step_2

Choose the .ovf file in the Turnkey directory you unzipped earlier.

turnkey_step_4

Click next and review the settings, making any changes as you see fit. The defaults should work fine. Then click import.

turnkey_step_3

Once Virtualbox finishes importing the virtual machine, you can start it up.

Assuming your network is configured correctly, the virtual machine will grab an IP from your DHCP server and be ready to go.

turnkey_startup

Step 4 – At this point you can either SSH into the virtual machine or you can connect using the web shell at the address indicated in the startup screen. Initially you can connect using as the root account with no password. You are almost ready to start installing node.js. First type “apt-get update” at the command line to make sure you have all the latest package information.

Step 5 – Install the developer tools you need to get and build node.js. Node.js isn’t packaged as a binary, you have to build it from source. Luckily it includes it’s dependencies and is pretty easy to build. But first we need to get a compiler. Type “apt-get install build-essential” and hit return. A lot of text will fly past, if it asks you if you want to go ahead press “y”.

Step 6 – Install Git. Now you’ve got a compiler installed, we have to install git so we can fetch node.js from the repository. At the command prompt type “apt-get install git”. Once that is complete, type “apt-get install git-core”.

Step 7 – Clone the node.js Git repository. If you want to put node.js is a specific directory, go ahead and make it then “cd” into the new directory. At the command prompt, type “git clone git://github.com/joyent/node.git“.

Step 8 – configure the source for building. type “cd node” and change into the node directory that Git created. Type “./configure”. You may see a few “fail” messages. Don’t worry about them.

Step 9 – Build node.js. Type” “make” at the command prompt. Get a sandwich or a nice cool drink. It doesn’t take very long, but it’s not very exciting unless the Matrix screensaver is your favorite screen saver.

Step 10 – Install node.js and start build applications. Type “make install” once the build is complete. Once that is complete,you can type “node” at the command prompt and you should see the standard help information fly by.

Building a node module or application is beyond the scope of this short tutorial. I suggest reading up at the Node.js site.

  • Pingback: Dew Drop – March 19, 2010 | Alvin Ashcraft's Morning Dew

  • Pingback: uberVU - social comments

  • phish

    thank you. very usefull.
    I would add a point before step 4. Check your /etc/resolv.conf file and make sure that these two lines appear.
    nameserver 208.67.222.222
    nameserver 208.67.220.220

    they are the primary and secondary DNS for principal FAI. Without that apt-get install command will fail because it will be unable to resolve domain name.

    Thanks again.

  • http://www.lazycoder.com Scott

    Excellent point phish. I didn’t run into that problem when I ran apt-get but it could come up.

  • http://www.oyun27.com oyun

    thank you. very usefull.

  • http://www.hireaspnetdeveloper.com/hire-csharp-net-web-developer-programmer.html Hire asp net c sharp developer

    Good job! You explained very clearly. It helped me! Thanks!

  • jj

    when i type ./configure,I got error”could not configre a c++ compiler”,and type “make”,I got error “command not found”

    help!

  • http://www.lazycoder.com Scott

    jj – You have to install the GNU build tools. See step 5.

  • nekdolan

    I followed the tutorial to the letter, but when I try to reach my node server on localhost, chrome says that the webpage does not exist. With https://192.168.1.101:12320/ I can reach my virtual linux and start any node source (it displays text like it should/sys.puts). I tried about 10 different server examples… none gave a response on http. I used ports 8000, 8080 and such…
    help me please!

    • nekdolan

      for some reason, right now it works
      weird
      nice guide btw

  • Kunal Gupta

    sweet

  • Stefa_N

    Hi,
    following these instructions is installing git 1.5.4.3. Latest version is 1.7.2.1. This is probably the reason why git states not knowing the option –recursive, which is required when installing Socket.IO. How can I update?

  • http://www.muhabbetgulu.net Muhabbet

    Excellent point phish. I didn’t run into that problem when I ran apt-get but it could come up.

  • http://www.arabasatan.com oto ilan

    Generally,it is useful sharıng.I waıt your sharıng lıke thıs.Thank you.

  • http://www.onsaleherveleger.com herve leger

    测试baidu
    [url=http://www.baidu.com]baidu[/url]

  • mikeruiz

    Your idea is so brilliant that could make myself indulge to any Essay Services or blogging for living.

  • http://lazycoder.com/?fcsite=01449382866239374553&fcprofile=10841519590132430792 nponeccop

    This thread is quite outdated. Node.js has been working on Windows under Cygwin for quite a long time already. There is official build guideline at http://github.com/ry/node/wiki/Building-node.js-on-Cygwin-(Windows) and unofficial binaries with Cygwin dependencies at http://node-js.prcn.co.cc

  • http://www.conversiondoubler.com Clint

    Awesome post! Time to get developing with node.js

  • http://www.shure.uk.com/ Shure Microphones

    I didn’t run into that problem when I ran apt-get but it could come up.

  • http://www.cheapuggtallboots.com ugg shop

    very nice article.

  • http://www.airforceones.cc/nike-dunk-low Nike Dunk Low

    If life is a quilt, then love should be a thread. So obvious. Nike Dunk Low.

  • http://louisvuittons.co/ Louis Vuitton Handbags

    Hi webmaster, commenters and everybody else !!! The blog was absolutely fantastic! Lots of great ED Hardy Handbagsinformation and inspiration, both of which we all need!b Keep ‘em coming… you all do such a great job at such Concepts… can’t tell you how much I, for one appreciate all you do!

  • http://www.ed-hardy.uk.com/ ED Hardy

    This is a very good idea! Just want to say thank you for the information, you have to share. Just continue to write such a position. I will be your faithful reader. Thank you ED Hardy Beltsagain.

  • http://www.nikeairuk.com/en/category/7-air-max-90.html Air Max 90

    I hope you have a nice Nike Shoxday! Very good article, well written and very thought out. I am looking forward to reading more of your posts in the future.

  • http://www.luxurymobileshop.com/ Nokia Vertu

    good post…oh coo, this information is really useful and definately is comment worthy! hehe. I’ll see if I can try to use some of this information for my own blog. VertuThanks!

  • Christian Sciberras

    That’s why I never really liked linux and open source, and never will. I’m no fanboy, but really look at the instructions from 4 onwards… no one, NO ONE without prior SPECIFIC linux knowledge would UNDERSTAND any of that.

    Just think of this, ask you girlfriend what the hell does “clone the git repo mean?”

    Honestly, this is a very useful step-by-step guide – and I like it – but it is one of the bummers in linux – and why I’ll be sticking with PHP for a while; to get PHP up and running, it requires nothing more than downloading and installing WAMP….no build, no copies, no git…just a clean install.

    That said, I’ve installed a LAMP environment on linux servers, several times so far, so I know what I’m saying. OS just sucks at presenting the tools to the users.

  • http://www.caloriesinfoods.org/ Calories in food

    I agree with you…

  • http://www.offshouldertops.net/ Off shoulder tops

    thanks. very useful. I would add a point before step 4. Check your / etc / resolv.conf and make sure these two lines appear. nameserver 208.67.222.222 nameserver 208.67.220.220 Would you same to position a journalist author on my diary?

  • http://www.hostdays.com Online Hosting Reviews

    http://www.lazycoder.com/weblog/2010/03/18/getting-started-with-node-js-on-windows/ is officially one of my favorite sites. Keep up the good work!

  • http://newapplemall.com cheap air max

    cheap air max

  • http://www.amandadollar.com/ dollar shops

    Good work,hope your blog be better!I just want to make a blog like this!

  • http://www.amandashoeswholesale.com/ shoes wholesale

    but I want to tell you there is a execting website dollar stores ,everything just be sold a dollar.yes ,it is true,my friend

  • http://pinnaclesecurity.com/state-UT.html utah home security systems

    Im really impressed on how it was made.

  • http://www.hiddendeckfasteners.net/ Hidden deck fasteners ideas

    thanks. very useful. Not at all. Sometimes there is a bad movie in cinema,  but more of them is good. But I think all of the hollywood movie is good in there and got a lot of viewers.

  • http://www.kidsboxinggloves.net/ New Kids boxing gloves

    Good job! You explained very clearly. It helped me! Thanks!A man is what he thinks about all day long.

  • http://www.logoinn.com/ logo design

    One quick question: What to do if you get ‘bin’ error on step 6? How to resolve it?

  • Pingback: MOIP – Labs : MoIP.js – Exemplo de integração do MoIP com o Node.js

  • Trifonova

    Hello, following these instructions in installing git 1.5.4.3. Latest version is 1.7.2.1. This is probably the reason why git states not knowing the option –recursive, which is required when installing Socket.IO. How can I update?
    payday loans overnight

  • http://www.ait2tape.net/ Ait 2 tape

    Nice tutorial for learning. Nice post really need of it.

  • http://www.fastenfinder.com wholesale fasteners

    Hi,

    Its really great post guys and so wonderful work. thanks guys for information about nix/BSD based system, its really so nice.

    Thanks

  • Jameslinen93

    Great post! I would like to thank for the effort in posting great article that can really helps for some people didn’t know yet of these and I am the one of those people. corporate training programs

  • Anonymous

     Great, 

    i love this idea, alot more than using cygwin on windows 7, though i’ve been running into trouble
    virtual machine is setup, network settings are ok, dhcp server picked up an IP, i can ping it from windows
    but, i cannot use the webshell / webmin or ssh connections, they all timeout and give me page not available

    any ideas?

    i’ve been looking for a simple setup to work on my desktop and run node on a virtualized env. had a full virtual ubuntu with node , but then i had to do too mutch work to get it running with the dev on the host pc, and hosting the server on the virtual one…
    this seems to be the solution, if i could get it to work :)

  • http://www.abler.com/products/Abfloxin Antibiotics for Horses

    Yeah, it really don’t run on windows. Thank you for this article that is posted here. 

  • http://www.abler.com/products/Abfloxin Antibiotics for Horses

    The post here was really helping me. I can now run it on widows that I have been using. Thank you!!!

  • me

    the adress has changed it’s now:
    git clone https://github.com/joyent/node

  • http://www.gmsc-recruiting.com/ teaching job in china

    The last time this happened
    to me was when I dug a bit deeper. Thank you for your help by posting this kind
    of article.

  • http://language1st.com/ online tefl courses

    Your post is
    really helping on me. Actually, I have this kind of problem when I upgraded my
    XP operating system to Windows Vista and node.js didn’t work.

  • Ivan Jouikov

    Any idea how I can make it so I can access a node http server can be accessed from the host OS (Win7)?

    I’m running VirtualBox in bridged mode & i can ping the guest OS, but can’t actually get to the :8080 where I’m running the following:

    var ip = ‘127.0.0.1’;var port = 8080;var http = require(‘http’);http.createServer(function (req, res) {  res.writeHead(200, {‘Content-Type': ‘text/plain’});  res.end(‘Hello Worldn’);}).listen(port, ip);console.log(‘Server running at http://‘ + ip + ‘:’ + port);

    If I try telnet from windows:

    C:UsersBAHO>telnet 192.168.0.187 8080Connecting To 192.168.0.187…Could not open connection to the host, on port 8080: Connect failed

  • Ivan Jouikov

    Any idea how I can make it so I can access a node http server can be accessed from the host OS (Win7)?

    I’m running VirtualBox in bridged mode & i can ping the guest OS, but can’t actually get to the :8080 where I’m running the following:

    var ip = ‘127.0.0.1’;var port = 8080;var http = require(‘http’);http.createServer(function (req, res) {  res.writeHead(200, {‘Content-Type': ‘text/plain’});  res.end(‘Hello Worldn’);}).listen(port, ip);console.log(‘Server running at http://‘ + ip + ‘:’ + port);

    If I try telnet from windows:

    C:UsersBAHO>telnet 192.168.0.187 8080Connecting To 192.168.0.187…Could not open connection to the host, on port 8080: Connect failed