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

No comments:

Post a Comment