Saturday, February 5, 2011

Install Node JS On Windows 2008 and Windows XP

Installing Node JS on Windows 2008 and XP, took me some time and a lot of Googling.
Plus, if you are like me: not a Linux and Cygwin guy, that's even more a challenge.
Anyway I was able to make it.

Here is a summary:

Remarks: On Windows XP thing are simpler, I will mention step that can be skipped for Windows XP. Different version of node.js seems to have different problems. So first I will install and compile node-v0.2.0.
At the of the post I will show how to download and compile node-v0.2.6.
At this time 2011/2/5, I have problems building v0.3.x. I decided not to look into it.

This post is based on information I gathered on the following blog posts and my own experiments:

- Step by step instructions to install NodeJS on Windows
- Node.js on Windows 7 under Cygwin, "FixImage error 13" problem
- cyg-apt

Installing cygwin.com

- Goto http://www.cygwin.com/ and download setup.exe
- Run setup.exe as an administrator















-  Filter on python and install all from the python section



- Filter on make and install all from the devel section


- Filter on G++ and install all from the devel section


- Filter on wget and install all from the devel section


Update file rebaseall (Not need for XP)
- With an editor open the file "C:\cygwin\bin/bin/rebaseall"
- Goto line 83 and comment line TmpDir="${TMP:-${TEMP:-/tmp}}"
- Add this line: TmpDir="/tmp"


- Goto line 110 and add this extra filter
-e '/\/sys-root\/mingw\/bin/d'



Run rebaseall (Not needed for XP)
- open a command prompt as administrator
- goto C:\cygwin\bin
- run ash.exe
- enter: rebaseall -v
- quit ash anyway you can (click the close icon)

Get the source code of node.js v0.2.0
- Open the Cygwin console
- Run this batch file as administrator C:\cygwin\Cygwin.bat
- type:pwd [enter]
- You should be located in your folder folder /home/ftorres which is on the disk C:\cygwin\home\ftorres
- To download source code and compile Node.js enter the following command

     wget http://nodejs.org/dist/node-v0.2.0.tar.gz
     tar xvf node-v0.2.0.tar.gz
     cd node-v0.2.0/
     ./configure
     make
     make install

- To check that node js has been built enter
      C:\>node --version

Testing helloWorld.js
- from http://nodejs.org/ download the hello world sample
- save it to a file in the current directory
- run node.exe HelloWorld.js
- Enter the following url in any browser http://127.0.0.1:8124


Get the source code of node.js v0.2.6
- Open the Cygwin console
- Run this batch file as administrator C:\cygwin\Cygwin.bat
- type:pwd [enter]
- You should be located in your folder folder /home/ftorres which is on the disk C:\cygwin\home\ftorres
- To download source code and compile Node.js enter the following command

     wget http://nodejs.org/dist/node-v0.2.6.tar.gz
     tar xvf node-v0.2.6.tar.gz
     cd node-v0.2.6/
     ./configure --without-ssl 
     make
     make install

- To check that node js has been built enter
      C:\>node --version



Issue with DNS


I tried to write a program that was downloading an rss feed and was faced with DNS error.

I find this post Getting Started with Node.js on Windows from Matthew Podwysocki,
which had the solution.

with the notepad create the file C:\cygwin\etc\resolv.conf and paste the following:

nameserver 8.8.8.8
nameserver 8.8.4.4

5 comments:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Node JS Online Training from India . or learn thru Javascript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Online Training

    ReplyDelete
  2. Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
    Best Devops Training in pune
    Microsoft azure training in Bangalore
    Power bi training in Chennai

    ReplyDelete

  3. It seems you are so busy in last month. The detail you shared about your work and it is really impressive that's why i am waiting for your post because i get the new ideas over here and you really write so well.

    Selenium training in Chennai

    ReplyDelete
  4. I was recommended this web site by means of my cousin.
    I am now not certain whether this post is written through him as nobody else recognise such precise about my difficulty. You're amazing! Thank you!

    Selenium training in bangalore
    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training

    ReplyDelete