JavaScript runtime that we use to build (and sometimes serve) web apps


Mac OS X

Using Homebrew:

$ brew install node

Alternatively, go to and install it manually.


Go to and install it manually.

Checking your installation

You should now have two new commands available, node and npm. Try them out:

$ node --version
$ npm --version

(It's OK if your version numbers are higher.)

Upgrading from an old version

You can simply install the latest version over your old one. Better still, install a version manager (see below) so you can switch between different versions easily.

Upgrading npm

npm is the package manager for Node. It comes bundled with Node itself, but you might sometimes want to upgrade to a newer version if one is available. Because npm is itself an npm package, it can upgrade itself like this:

npm install --global npm

After that, npm --version should show that you're on the latest available version.

🎱 Bonus steps (for an optimal Node set-up)

These extra steps are not essential, but are recommended.

Relocate your global packages to your home directory

Follow these steps to relocate your global node_modules directory so it's under your home directory.

Doing this means you'll be able to install global modules without sudo, which is easier and safer.

Install a version manager

Sometimes you have to open an old project that requires an old version of Node, and it's a pain to have to uninstall and reinstall Node just for this.

A version manager solves this problem: it lets you easily switch between Node versions with a simple command. It also makes it easier to get the latest Node when they release a new version.

There are two popular version managers available: n and nvm.

To install n (recommended):

npm install --global n

Now try switching to a different Node version (try node --version after each one, to verify that the version actually changed):

  • type n 0.12 to switch to version 0.12
  • type n 4.2 to switch to version 4.2
  • type n stable to switch to the latest stable version (this is the one you should generally stick to)