NodeJS By Examples

Installation

Use npm to install your NodeJS server.

If node already is installed run:

#which node

/usr/bin/node

#node -v

v0.10.31

 

Notice:

If you get older version of Node then run

#apt-add-repository ppa:chris-lea/node.js

#apt-get update

#apt-get install nodejs

 

A) UBUNTU apt-get

#apt-cache search node

#apt-get install nodejs

Installs into /usr/lib/nodejs/ dir. In that dir are nodeJS modules: http.js, url.js, ...

Also with NodeJS is automatically installed NPM (Node Package manager) into /usr/lib/node-modules/npm/

 

#apt-get remove nodejs

Deinstall node.

 

 

B) NPM

Now you can install specific node module with NPM command.

For example:

#cd /us/lib/node_modules/

#npm install -g nodemon

Option -g installs globally!