As a first task, we will need a copy of Node JS running on our system. We can get this piece of software in different ways on different systems. This book covers the installation process on Windows and Linux systems. After the installation, everything will work similarly from the command line or terminal.
If you use the Mac OS X, there are great tutorials to install Node JS on the Web. The http://coolestguidesontheplanet.com/installing-node-js-on-osx-10-10-yosemite/ website shows you how to install it with a precompiled binary (do not be misled by the title; it's the one for El Capitan), while http://sourabhbajaj.com/mac-setup/Node.js/README.html shows you how to install it using brew.
To get Node JS on Windows, we have to download the installer from its home page. First, we navigate to https://nodejs.org/en/, where the site tries to detect our system configuration and automatically offers a version to download. In most cases, this version is the appropriate one.
Next, we download the installer and run it. Then, the installation wizard leads us through the installation process. We can leave every option in their default values. After the installation is finished, we get some shortcuts for different purposes:

From the available shortcuts, we will need the command prompt (Node.js command prompt) as we will need to start various JavaScript programs. When we start a program, we get a default command line with the message: the command line is configured to work with Node JS. The only thing left to do is navigate to the folder containing the source code of OpenLayers 3. We can easily do this with the cd command and a relative path from the current directory.
If you have your source code on a different partition, you have to change the current partition first. You can do this by simply typing in the letter of the partition. For example, if you have your source code on partition D and you are in partition C, just type D: in the command prompt before changing the current directory.
In Linux, we can easily install Node JS if we have a distribution with a package management system. The only restriction is that we must have superuser privileges to install new packages. Therefore, we have to change to a superuser with su or prepend sudo to the following commands. For Debian-based distributions (such as Ubuntu), we have to run the following command in the terminal:
apt-get install node
In systems based on Fedora and Red Hat, we can use the yum package manager to achieve the same results:
yum install node
If we used su to switch to the superuser, we switch back with the exit or logout commands, and navigate to the source code's directory using cd.
The installation process of Node JS gave us two programs for our use: node and
npm. npm stands for Node Package Manager, and we will use it to install every dependency of OpenLayers 3. npm can be used to install packages globally or only for a single project. We will use the latter option as it is a cleaner solution for our case. From now on, every step will be almost identical on different operating systems.
To resolve the dependencies of OpenLayers 3, we only have to type the following command in the terminal from the directory of the source code (src/ol3-3.11.1):
npm install
If we wait for the command to finish, we will notice that there are two new folders in the directory, called node_modules and build. The node_modules folder contains every node package used by OpenLayers 3 on compilation. The other folder contains some external JavaScript libraries, which are bundled with OpenLayers 3.