Node.js File is the file that consists of information related to the task of the event to be executed. Node.js files are saved with the .js extension and should be initiated prior to the functioning of web server.
Setup of Node.js
For setting up of Node.js, two major software is required, the text editor and binary Node.js installable. Text Editor is used to write the source code of the program and is also known as the source file. Text editor can be Notepad, Edit Command, Epsilon, Vim or VI, brief and EMACS. Note that the type of text editor which will be installed depends on the Operating System being used as a platform. For instance, WordPad will be used for Windows; Vim or VI can be used for UNIX, Linux or Windows, and so on. These source files are saved into the system with .js extension.
Steps to Install and setup Node.js in Windows
1. Download the Node.js Installer
The first and foremost step for setting up the Node.js is to install it for which it is important to download the .msi installer. For downloading the Node.js .msi Installer, you can go on to the official page of Node.js where you will find the option of Windows Installer placed at the top of the page. On clicking the option, the downloading of the installer will start. Make sure that you download the installer at the folder which is easier for you to find.
2. Run the Node.js Installer
After downloading the Node.js Installer, you are ready to go to the next step. Note that the installer acts as a wizard interface which can be used as a medium to download software on Windows. For installing the Node.js, you will have to run the installer following the given below steps:
1st Step: On the Welcome page of the Installer, click next.
2nd Step: Accept the End User License Agreement (EULA) by clicking on I Accept and click on next.
3rd Step: Choose the Destination Folder and click on next.
Note that by default, the destination folder for Node.js used by windows is C:\Program Files\nodejs.
4th Step: In the custom setup interface, click on next.
5th Step: In the Ready to Install Node.js interface, select Install.
Note that this process may require an administrative authorization to take place. If prompted, provide the authentication.
Final Step: After the download is completed, click on Finish.
The Node.js Installation is complete.
3. Verify the Installation
After the installation of Node.js, it is also important to verify that the installation has been completed successfully in order to ensure that the application will run properly. To verify the installation, run the following command in the command prompt:
$ node -v
After running the command, if Node.js has been successfully downloaded, the respective version of the installed Node.js will be printed as an output.
$ node -v //command
v0.10.35 //version of Node.js installed
4. Update the Local NPM Version
After successfully installing the Node.js, it is very important for you to update the NPM version of Node.js which can be defined as the package manager linked with Node.js. Every Node.js file comes with its version of NPM which is not automatically updated by Node.js itself.
Note that it is very important to update the Node.js with newest version of NPM as the release of NPM CLI client is not synced with Node.js and you will certainly find an update to the version already installed for the current Node.js. Thus, to update the local NPM version, you may type the following command into the command prompt:
nom install nom --global
5. Build the application
After installing the Node.js and updating NPM, you are all ready to go! You may now start exploring and building new applications.