How To Install NodeJs And How To Test If It’s Working Fine!

By | September 26, 2016

how to install nodejs

NodeJs is one of the other JavaScript written for servers. But to learn it precisely, you should be aware of the advanced JavaScript concepts and basic knowledge of HTML and CSS would be an added advantage as that’ll help you understanding the templating part.

What exactly is NodeJs?

It is a JavaScript environment with multiple purposes specifically built on Chrome’s V8 Javascript engine. It depends on external and internal package and uses an event-driven, non-blocking I/O model, which is why it’s lightweight and effective.

To develop a project with NodeJs, having an additional framework is advisable to that can use Node.js methodologies like Express.js and Koa.js

Ways To Install NodeJs On Your Machine

1) The .MSI (Installer Wizard)

Download a .MSI installer from the official site according to your machine configuration. With .MSI installer, everything will automatically be set up including environment variable.

But keep a note that you cannot change through the versions and if you do, then you would be required to run the installer again.

2) Node Version Manager (NVM)

It is another way to setup node locally. NVM is advantageous if you are frequently switching between the node versions and is highly recommended to the deployment team. Installing it is much easier if you are using a Window’s PC otherwise, you might need to run through different errands to get it installed on your PC.

Note: Setup NVM before Installing NodeJs.

If you’re switching the versions, you need to reinstall the global modules earlier installed on your PC. Furthermore, you should be aware of commands related to CLI.

3) Compiled Source

If you are looking for all the latest from the core team of NodeJs, download its compiled sourced directly from Github.

Note:  Though you have the latest code, you would require to compile it manually on your machine. It takes longer than .MSI and NVM to build and deploy the code manually. It is not supportive to frequent version change as each time you change the version; it needs reprocessing regarding compilation, build and deployment.

Now, it’s the time to test it:

Ensure that you have NPM & Node installed with the help of simple commands to see the versions to run a test:

If you want to see if the Node is installed:

  • Open the Windows Powershell, Command Prompt or a similar command line tool.
  • Type node -v. It’ll print a version number and you may see something like v0.10.35.
  • If you want to see if NPM is installed:
  • Type npm -v in Terminal.
  • It should print NPM’s version number and you’ll see something like 1.4.28

Now, create a test file and run it. An easy technique to test whether node.js works or not is by creating a JavaScript file:

  • name it hello.js
  • add the code console.log(‘Node is installed!’)
  • Run the code simply.
  • Open your command line program
  • Navigate to the folder where you save the file and type node hello.js. This whole process will start Node and run the code in the hello.js file.
  • Now, You should see the installed output Node.

Conclusion:

In the end, everything is up to you to choose the method of installing NodeJs as per different choice suitable the best to your working environment. If you could share some more techniques to install NodeJs, it’ll help our readers and us. Comment!

Author Bio :

Sophia Phillips is an expert frond-end & WordPress developer. Currently, she is employed with WordPrax Ltd.- a leading PSD to WordPress theme converter company. Sophia has had written a remarkable number of articles on WordPress tricks and tips.

Are you looking for a Web Development Jobs in Gulf Region? Please follow below:
Top Gulf Jobs