Author: Dawid Adach
Goal
The goal of the following tutorial is to guide you on how to install all the software required to start our journey with React. If you have your environment ready, you can skip to the next tutorial. However, if you never worked with npm before, this is a place to start from. The steps below will guide you on how to install all prerequisites regardless of platform (Windows, macOS, unix) you are using. Let's start!
1. Command line
The command line is crucial for each developer. If you haven't used it before it's high time to get familiar with it. It might look complicated and difficult to learn, however, once you put your hands on it you will find that is a very powerful and useful tool.
How to run the command line?
Keyboard shortcut:
On your keyboard press: + R . You will see Run
windows. Type cmd
and click OK or press Enter

You will see the screen below:

That's it. You can now use a command line, however, please keep in mind that Windows Command Line is frankly speaking - crappy tool. That's why we strongly encourage you to use some alternative like GitBash (installation guide here). It has more unix-like commands which are more user-friendly than built in windows commands.
How to run the command line?
Keyboard shortcut:
Press cmd ⌘ + space to open Spotlight search, type terminal
and hit Enter ⏎

You will see the screen below:

Unix unlike Windows or macOS, doesn't necessarily have a Graphic User Interface (GUI), therefore in some distributions like RedHat, CentOS, Debian, Ubuntu Server, the terminal will launch immediately after booting up the machine.
In case you use some GUI, they may look different, however in most cases they will have Windows-like "Start" button which will open the search menu which allows you to find theterminal
app.
Sample start screen on Ubuntu:

Also terminal windows and colors may vary depends on distribution, sample Ubuntu terminal:

Since you know how to run terminal, let's move to our runtime environment - Node.js.
2. Installing Node.js and Node Package Manager (npm)
2.1 Video
2.2 Written
- Download the Windows installer from the Nodes.js® web site.
- Run the installer (the .msi file you downloaded in the previous step.)
- Follow the prompts in the installer (Accept the license agreement, click the NEXT button a bunch of times and accept the default installation settings).
- Restart your computer. You won’t be able to run Node.js® until you restart your computer.

- Download the Windows installer from the Nodes.js® web site.
- Run the installer (the .msi file you downloaded in the previous step.)
- Follow the prompts in the installer (Accept the license agreement, click the NEXT button a bunch of times and accept the default installation settings).

Ubuntu/Debian
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
Red Hat® Enterprise Linux® / RHEL, CentOS and Fedora
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum -y install nodejs
Arch Linux
pacman -S nodejs npm
3. Verifying installation
It's time to check that Node and NPM are installed correctly. We will simply run a few commands to see what version of each is installed and to run a simple test program:
- Test Node: Open command line and type:
This should print a version number, so you’ll see something like this:node -v
v8.9.1
- Test npm: To see if NPM is installed, type:
This should print NPM’s version number so you’ll see something like this:npm -v
5.5.1
- Verify JS: Create a file called
hello.js
and type inside:console.log("Hello world from MDB");
Open the terminal, navigate to the folder where you have created the file and type
you should see the following output:node hello.js

Now let's move to the next lesson and start building some real applications in React.
Previous lesson Next lesson
Spread the word:
