Installing Node.js





Earlier JavaScript was identified as a client side scripting language which had no proper means to interact with server side. Therefore front ends of most applications were written in JavaScript whereas the back end in PHP. JavaScript did well in validating forms, showing and hiding data dynamically, using animations etc. This was pretty cool, but what if we can use JavaScript for writing the back end too. Then programming would have been easy, clean and methodical. So, a solution came up with Node.js. Node.js changed the image of JavaScript as a client side scripting language. If you are familiar with JavaScript, Node.js is just like JavaScript in its syntax. The definition of Node.js as supplied by its official website is as follows.

"Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world."

Infact Node.js is an open-source, cross-platform runtime environment for developing server-side web applications. Node.js applications are written in JavaScript and can be run within the Node.js runtime on a wide variety of platforms, including OS X, Microsoft Windows, Linux, FreeBSD, NonStop, IBM AIX, IBM System z and IBM i. Its work is supported by the Node.js Foundation which is a collaborative project at the Linux Foundation. 

Node.js uses Google V8 JavaScript engine to execute code, and a large percentage of the basic modules are written in JavaScript. Node.js contains a built in library to allow applications to act as a stand alone web server.Currently, Node.js is used by IBM, Microsoft, Yahoo, Walmart, Groupon, SAP, LinkedIn, Rakuten, PayPal, Voxer and GoDaddy.


Try out Node.js

Having a basic understanding of JavaScript would benefit you to walk through with Node.js. As we are going to develop web-based applications using Node.js, it will be good if you have some understanding of other web technologies such as HTML, CSS, AJAX, etc. You need following to set up the local environment.

1. Text Editor
This will be used to type your program. Examples of few editors include Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi.

2. The Node.js binary installables
Download latest version of Node.js installable archive file from Node.js Downloads.

In order to start with, let's try to install Node.js in our machine. This post describes the method of installation of Node.js in Linux OS and Windows OS. Lets start with Windows users.


Installing Node.js in Wndows

Use the MSI file and follow the prompts to install the Node.js. Download the Node.js source code or a pre-built installer for your platform, and start developing today. You can get the installers from here



Installing Node.js in Ubuntu

If you are using Ubuntu 13.04 or a higher version, executing the following commands to install Node.js would be more easy.This will install Node.js and npm.
$ sudo apt-get install npm
$ sudo ln -s /usr/bin/nodejs /usr/bin/node


Troubleshooting

When I was installing Node.js in Wndows OS, it gave me the following error message.




This error may occur due to different reasons.

1. The computer does not meet the minimum requirements for Pix4Dmapper.

2. Windows is not updated.

3. Not full access to the folder: C:\Users\<username>\AppData\Local\Microsoft\Windows\ or C:\Users\<username>\AppData\Local\Temp\

In order to resolve this issue, check out the following steps sequentially. For me, it was the third reason.

1. Confirm that the computer where Pix4Dmapper is being installed has the minimum requirements: 

2. Make sure that is Windows updated.

3. Change the permissions to full access. Go to Properties -> Security on the C:\Users\Username\AppData\Local\Temp folder and give 'Everyone' the 'Full control' permission. Then the installer that previously failed worked successfully for me.

Verifying the installation

In order to verify the installation, go to command prompt(cmd) of the machine and type node. Then you will be navigated to the REPL terminal. REPL stands for Read Eval Print Loop and it represents a computer environment like a window console or Unix/Linux shell where a command is entered and system responds with an output in interactive mode. Node.js or Node comes bundled with a REPL environment. 
Then type the following. 

console.log('Welcome! Node.js is installed properly');

If Node.js is installed properly, you will see this message on REPL. 

nanduni@nanduni-TECRA-M11:~/Documents/nodejs$ node
> console.log('Welcome! Node.js is installed properly');
Welcome! Node.js is installed properly

Hope you would be able to try out your first Node.js application soon.

1 comment :

  1. Nice blog.. Thanks for sharing informative blog.. I just want to say that all the information you have given here is awesome...great and nice blog thanks sharing. Hire Nodejs Developers

    ReplyDelete