Skip to main content
Eystein codes

How to install Node.js

So many tutorials start with npm install, but how do you go about actually installing this npm? I have to look it up fairly regularly, so here are my notes.

Node and Homebrew are apps #

Homebrew and Node are both installed globally for your user on your computer. Consider them software on your computer in a similar way to Word or Photoshop, tools to create things.

Homebrew #

Annoyingly, I'll start with installing something else before installing Node. Welcome to the world of package managers. There's always another thing to install before the thing you came to install :/

And this time that other thing is "Homebrew". Shortly explained, it helps us installing other things in the Terminal. To install we need this snippet from it's website:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

It asks for your password to be allowed to create a bunch of new files and folders on your computer.

Check if Homebrew is installed #

brew --version

If Homebrew is installed, it should return Homebrew 2.2.4. (That's the current version number, it will most likely have changed when you read this)

Install Node and NPM #

We can now use the new brew command to install node:

brew install node

It takes a while to download and install.

Check if Node is installed #

We can check if Node is installed the same way we checked if Homebrew was installed. By adding the --version attribute to the end of the command.

node --version

node -v // This returns the same result

Today, that command returns v10.13.0

Check if NPM is installed #

npm -v

And today, this returns 6.13.6.

Node vs NPM?! #