Node can either be installed using conventional application installers or by using the command line. Command-line installation is easy on OS X and Linux, but it’s not recommended for Windows.
A.1. OS X setup
The official installer provides an easy way to install a precompiled version of Node and npm.
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
//Install Node
brew install node
A.2. Windows setup
Node can be most easily installed on Windows by using the official standalone installer. After installing, you’ll be able to run Node and npm from the Windows command line. If you want install it by source code, you may need Cygwin to run Node. Cygwin’s package selector allows you to select open source software that will be installed on your system.
devel git
devel make
devel openssl-devel
devel pkg-config
devel zlib-devel
net inetutils
python python
web wget
Once you’ve selected the packages, click Next. run Cygwin and compile Node.
A.3. Linux setup
there are other installation instructions on GitHub:
sudo apt-get install build-essential libssl-dev
sudo yum groupinstall 'Development Tools'
sudo yum install openssl-devel
Compiling Node involves the same steps on all operating systems.
>mkdir tmp
>cd tmp
>curl -O http://nodejs.org/dist/node-latest.tar.gz
>tar zxvf node-latest.tar.gz
>ls
>cd node-v*
>./configure
>make
>sudo make install
>node -v
if you run Cygwin On Windows 7 or Vista,it maybe have errors。this is because of Cygwin.Just quit Cygwin enviroment,run ash.exe(c:\cygwin\bin\ash.exe), and enter /bin/rebaseall -v。then restart your computer.
You should now have Node on your machine!
Using the Node Package Manager
The Node stack is composed of globally available functionality, core modules, and community-created modules.
git clone git://github.com/isaacs/npm.git
cd npm
sudo make install
Searching for packages
npm search xml generator
or you can use http://search.npmjs.org/ to search the info. The npm search website provides useful statistics on module popularity.
> npm install express
//installing the express package globally:
>npm install -g express
//or
>sudo npm install -g express
>npm docs express
//explore the local express source code
>npm explore express
//explore the global express source code
>npm -g explore express