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 mac operating system
This guide assumes that you are using mac os. 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 mac
1.Visit nodejs download page here
2.Click on macOS Installer to download the latest version of node installable package.
1.Click on the download node-vxx.xx.xx.pkg (for example node-v10.15.0.pkg) in previous step to start the installation which brings up below screen. Please click continue
2.By clicking continue in previous step you will be asked to accept license, please click continue
3.Please accept the agreement by clicking Agree
4.Click continue
5.Click install, which would prompt you for the credentials
6.Provide username and password and click Install Software
7.On successful installation you will see the below screen which shows the summary of the installation.To access the node and npm executable from terminal make sure /usr/local/bin is in your $PATH. You can verify that by running echo $PATH command in terminal
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.
Leave a Reply
Your email address will not be published. Required fields are marked *