Node.js Installation



To install node.js we need to install dependencies
-----------------------------------------------------------------
apt-get update
sudo apt-get install libssl-dev
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
Check the python version as well

Note: There has some possibility to have an error  when we try to install the node Because of the Dependencies .So Please recheck the dependencies

Install from the downloaded version of node from node site
----------------------------------------------------------------------------------
tar -zxf node-v0.6.18.tar.gz #Download this from nodejs.org
cd node-v0.6.18
./configure && make && sudo make install


Clone node.js from github and installation process
----------------------------------------------------------------------
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install


Test the version and conformation of installtion
------------------------------------------------------------------
node --version //This will print the version of the node.js


Node as a real time console
--------------------------------------
Here we can check the single code or any command with node command prompt. For that in terminal text “node” Then automatically the command prompt redirect to node.js console for real . To print some line “hello node.js” in command prompt.

Example:
dhanushanth@ubuntu:~/node$ node
> console.log('hello Node.js')
hello Node.js


Run external .js files using node
--------------------------------------------
Say If the Java script file name is helloPrint.js then,
To run using terminal:
node helloPrint.js

If any issue with installation feel free to mail : dhanu.chrish@gmail.com

No comments:

Post a Comment