Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser. Node.js lets developers use JavaScript to develop wide variety of applications like network applications, command line tools, web api, web applications
In this document, we will cover installation procedure of nodejs on Ubuntu 16.04 operating system
This guide assumes that you are using Ubuntu16.04. Before you begin, you should have a user account with installation privileges and should have unrestricted access to all mentioned web sites in this document.
This document can be referred by anyone who wants to install latest nodejs on Ubuntu 16.04
cd ~ curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
The PPA will be added to your configuration and your local package cache will be updated automatically
node -v
You should see an output like below (Note: Your version may vary depending on your date of installing as nodejs team make an aggressive release but make sure your node version is > v10.0.0)
npm -v
You should see an output like below (Note: Your version may vary depending on your date of installing as nodejs team make an aggressive release but make sure your npm version is >5 )
console.log("Hello World Node!!")
node helloworld.js
node command line with file name as an argument will load, read, compile and execute the instructions from the file and execute them. Since we have one line of JS code which prints the text “Hello World Node” to console inside helloworld.js file you see the output as shown in above screenshot
sudo apt remove nodejs
Leave a Reply
Your email address will not be published. Required fields are marked *