How to install node js
JavaScript is hugely popular amongst developers because it is efficient, event-driven and fast. It adds interactive features to a website and makes it user-friendly. With Node.js, the JavaScript run-time engine built on Chrome’s V8 JavaScript engine, the same JavaScript language can be used to write server-side code as well. Read nodejs interview questions to know how.
Having the same programming language for both server-side and client-side scripts also integrates the web application development and makes it programmer-friendly. Read more about JavaScript and client-side scripting from our website Best Interview Questions.
What is node.js?
At first sight, node.js may seem to be a filename to you. However, it is an open-source, cross-platform JavaScript RTE (run-time environment) that helps developers to write server-side scripting code outside of a browser. This means a single programming language for both server-side and client-side scripts that fully integrates web application development.
Node js installation steps for Windows
Step 1
Download the product’s windows installer from https://nodejs.org/en/download/
Step 2
Windows will give you an option to Run the installer file (.msi)
Step 3
The next screen will be license agreement, tick the check-box and click on next.
Step 4
By default, Windows will choose Program Files to install the software. You can retain the same or prefer a custom location.
Step 5
Next step is to select the features to be installed. The default setting is just elegant, and you can go ahead on this step. You can check your disk usage and free up the required space if needed.
Step 6
Click on install!
Step 7
You can check the status and can cancel the installation if you have to.
Step 8
Before installation, Windows will ask you permission to install the software, click on YES.
Step 9
9. The installation will take a few more minutes.
Step 10
Click on the Finish button once the installation process is done.
Step 11
To check if the installation is proper, you can open command prompt using cmd and type basic commands.
Step 12
12. Next, you can create a test file to see if the software executes your JavaScript file. Create a file named testnode.js, with the only code as
console.log('Node.js, is successfully installed');
Step 13
From a command prompt, execute the command node testnode.js to see the output printed on the console. If it is rightly written, you can be happy – the installation is successful! Check out Best Interview Questions on our website, to know more about the features, commands, and benefits of using node.js
Note –
- There is no need for a computer restart for node.js to work; however if your command prompt is already open, you will need to close and reopen it for the updated PATH to be loaded.
- By default, the installer sets the environment variables (PATH). If you experience an error, check if the PATH is set correctly.
- Installing node.js on Linux and Mac is also simple as in Windows but needs some dependencies like Ruby, GCC or Homebrew package manager for Linux and Mac.