Node.js

Node.js

If you installed Homebrew in the previous step, use it to install Node.js:

user@localhost ~
 
brew install node

If not, you can click one of the big, green download links on the Node.js web site.

Note

Node version numbers are confusing, but either the LTS version (6.10.2 as of this writing) or the Current version (7.9.0) will do for our purposes.

Testing your installation

After Node is installed, test your installation by running NPM, a JavaScript package manager that’s included with Node. Run the following command:

user@localhost ~
 
npm install -g create-react-app

You should see a progress bar of sorts while packages download and, eventually, a tree structure of various package names and version numbers. As you may have guessed, aside from testing your Node installation, this has the side effect of installing create-react-app, which we’ll later use to do exactly what its name suggests.

tip

If the npm command isn’t available, open a new tab in your terminal and try again. Opening a new tab should make node and other related commands available to you from any directory, if they weren’t already.

Yarn

Yarn is an alternative to NPM that offers several advantages—not the least of which is speed.

If you’ve installed Homebrew, run the following command to install Yarn:

user@localhost ~
 
brew install yarn

Otherwise, follow the insructions on the Yarn site to Install Yarn.

Testing Yarn

Once Yarn is installed, run this command to test it:

user@localhost ~
 
yarn global add eslint