Installing Node.js
What is node.js?
“Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.”
You can download node.js from their website. Since I am using a mac, I decided to download the pkg file, and not bother to install from source.
After the standard install finishes, Node will be installed under /user/local/bin/node
and npm will be installed under /user/local/bin/npm
. To make it more useful it would be good to add both locations to your path. I did so by adding the follow lines:
# Node export NODE_HOME=/usr/local/bin/node export NPM_HOME=/usr/local/bin/npm export PATH=$NODE_HOME:$HPM_HOME:$PATH
Once that was complete, source the script, or log into the terminal, and you are able to run NPM or node right away. Remember that if you’re going to use NPM to install a package, that you will need to be root or use sudo to do so.