Step 1. Press Cmd+Space to open Spotlight Search, and type Terminal. Click on the first search result to open it.
Step 2. Check whether Node.js is installed on your machine by writing the following command:
node -v
Press Enter.
If you see any version being returned to you, it means that Node.js is installed on your machine and you can skip steps 3 and 4.
If you see the message ‘node: command not found’, which means that Node.js is not installed on your computer, close your Terminal and proceed to the next step.
Step 3. Go to this link to download Node.js.
On the webpage under LTS (Recommended For Most Users) tab, click on macOS Installer (.pkg) - 64-bit. This will download the latest version of Node.js for you.
Step 4. Double-click on the downloaded file. Proceed with the default instructions to install Node.js.
In order to verify that it has been correctly installed, open Terminal again and go back to step 2. If you see a version of Node.js being returned to you, it means that you have successfully installed its required version on your machine. However, if you still cannot see the version returned to you, you will need to uninstall (if required) and then re-install Node as explained above.
Happy coding!