Node.js allows one to run JavaScript outside the browser. It is especially useful for running React which is a JavaScript framework. You could either Install Node.js by downloading the package from their website or use a Package Manager. Installing it via a package manager is the preferred method.
A package manager for Mac that you could use is Home Brew. In order to Install the Package Manager enter the following command in the terminal
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Home
brew/install/master/install)"
This Installs the Package Manager. The next step is Installing Node.js and NPM which is a package manager for JavaScript. All you have to do is type this command in the terminal
brew install node
This Installs Node.js and NPM. In order to ensure that node.js has been Installed, type this command in the terminal
node -v
If it returns a version number, it means that node.js has been successfully Installed.
Let’s summarise, there are two steps in Installing Node.js
- Install a Package Manager for Mac. In this case we have Installed HomeBrew.
- Once Installed, Install node by typing the install node command in the terminal.