Download Node.js and run the install
In Sublime, go to Tools > Build System > New Build System and paste the following code:
"cmd": ["node", "$file"],
Make sure this is the only code you see.
Save the file as “node.sublime-build” in the default “user” folder, which should already be populated for you.
If you receive a [Errno 2] error when trying to use the console, then you’ll need to change “node” in the code above to the path where node is located. To do this, type ‘which node’ in terminal, copy the url path, and paste over “node” in your code.
How to use the console:
Now just click command + b whenever you want to build (run) the JS file!