Skip to content

Commit

Permalink
Docs: Update install instructions for Windows and Linux on the "Part …
Browse files Browse the repository at this point in the history
…0" page (#18262)

* improve setup instructions for windows and linux

* grammatical tweak

* add instructions per package manager on linux

* remove emoji, add npm info paragraph

* Add instructions similar to "Gatsby on Linux" page

* lint, fix typo, small improvements

* lint part 0 tutorial

* update image with correct Node.js versions

* Apply suggestions from code review

- Wording improvements
- Structure improvements

Co-Authored-By: LB <[email protected]>

* Wording fix

* add node and npm version check instructions
  • Loading branch information
1qk1 authored and LB committed Dec 12, 2019
1 parent fe8321c commit e89d3f3
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 20 deletions.
Binary file modified docs/tutorial/part-zero/01-node-npm-versions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 61 additions & 20 deletions docs/tutorial/part-zero/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,89 @@ Before you start building your first Gatsby site, you’ll need to familiarize y

The command line is a text-based interface used to run commands on your computer. You’ll also often see it referred to as the terminal. In this tutorial, we’ll use both interchangeably. It’s a lot like using the Finder on a Mac or Explorer on Windows. Finder and Explorer are examples of graphical user interfaces (GUI). The command line is a powerful, text-based way to interact with your computer.

Take a moment to locate and open up the command line interface (CLI) for your computer. Depending on which operating system you are using, see [**instructions for Mac**](http://www.macworld.co.uk/feature/mac-software/how-use-terminal-on-mac-3608274/), [**instructions for Windows**](https://www.quora.com/How-do-I-open-terminal-in-windows) or [**instructions for Linux**](https://www.howtogeek.com/140679/beginner-geek-how-to-start-using-the-linux-terminal/).
Take a moment to locate and open up the command line interface (CLI) for your computer. Depending on which operating system you are using, see [**instructions for Mac**](http://www.macworld.co.uk/feature/mac-software/how-use-terminal-on-mac-3608274/), [**instructions for Windows**](https://www.lifewire.com/how-to-open-command-prompt-2618089) or [**instructions for Linux**](https://www.howtogeek.com/140679/beginner-geek-how-to-start-using-the-linux-terminal/).

## Install Homebrew for Node.js
_Note: If you’re new to the command line, "running" a command, means writing a given set of instructions in your command prompt, and hitting the Enter key”. Commands will be shown in a highlighted box, something like `node --version`, but not every highlighted box is a command! If something is a command it will be mentioned as something you have to run/execute._

To install Gatsby and Node.js, it is recommended to use [Homebrew](https://brew.sh/). A little set-up in the beginning can save you from some headaches later on!
## Install Node.js for your appropriate operating system

How to install or verify Homebrew on your computer:
Node.js is an environment that can run JavaScript code outside of a web browser. Gatsby is built with Node.js. To get up and running with Gatsby, you’ll need to have a recent version installed on your computer. npm comes bundled with Node.js so if you don't have npm, chances are that you don't have Node.js either.

### Mac instructions

To install Gatsby and Node.js on a Mac, it is recommended to use [Homebrew](https://brew.sh/). A little set-up in the beginning can save you from some headaches later on!

#### How to install or verify Homebrew on your computer:

1. Open your Terminal.
1. See if Homebrew is installed by running `brew -v`. You should see "Homebrew" and a version number.
1. If not, download and install [Homebrew with the instructions](https://docs.brew.sh/Installation) for your operating system (Mac, Linux or Windows).
1. If not, download and install [Homebrew with the instructions](https://docs.brew.sh/Installation).
1. Once you've installed Homebrew, repeat step 2 to verify.

### Mac Users: install Xcode Command Line Tools
#### Install Xcode Command Line Tools:

1. Open your Terminal.
1. On a Mac, install Xcode Command Line Tools by running `xcode-select --install`.
1. If that fails, download it [directly from the Apple site](https://developer.apple.com/download/more/), after signing-in with Apple developer account
1. Install Xcode Command line tools by running `xcode-select --install`.
- If that fails, download it [directly from Apple's site](https://developer.apple.com/download/more/), after signing-in with an Apple developer account
1. After being prompted to start the installation, you'll be prompted again to accept a software license for the tools to download.

## Install Node.js and npm
#### Install Node

Node.js is an environment that can run JavaScript code outside of a web browser. Gatsby is built with Node.js. To get up and running with Gatsby, you’ll need to have a recent version installed on your computer.
1. Open your Terminal
2. Run `brew install node`
- If you don't want to install it through homebrew, download the latest Node.js version from [the official Node.js website](https://nodejs.org/en/), double click on the downloaded file and go through the installation process.

_Note: Gatsby's minimum supported Node.js version is Node 8, but feel free to use a more recent version._
### Windows Instructions

1. Open your Terminal.
1. Run `brew update` to make sure you have the latest version of Homebrew.
1. Run this command to install Node and npm in one go: `brew install node`
- Download and install the latest Node.js version from [the official Node.js website](https://nodejs.org/en/)

Once you have followed the installation steps, make sure everything was installed properly:
### Linux Instructions

### Check your Node.js installation
Install nvm (Node Version Manager) and needed dependencies. nvm is used to manage Node.js and all its associated versions.

1. Open up your terminal.
2. Run `node --version`. (If you’re new to the command line, “run `command`” means “type `node --version` in the command prompt, and hit the Enter key”. From here on, this is what we mean by “run `command`”).
3. Run `npm --version`.
_💡 If when installing a package, it asks for confirmation, type `y` and press enter._

#### Ubuntu, Debian, and other `apt` based distros:

1. Run `sudo apt update` and then `sudo apt -y upgrade` to make sure your Linux distribution is ready to go.
2. Run `sudo apt-get install curl` to install curl which allows you to transfer data and download additional dependencies.
3. After it finishes installing, run `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash` to download the latest nvm version.
4. To confirm this has worked, use the following command. `nvm --version`. The output should be a version number.
5. [Set default Node.js version](#set-default-nodejs-version)

#### Arch, Manjaro and other `pacman` based distros:

1. Run `sudo pacman -Sy` to make sure your distribution is ready to go.
2. These distros come installed with curl, so you can use that to download nvm.
`curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash`
3. Before using nvm, you need to install additional dependencies by running `sudo pacman -S grep awk tar`.
4. To confirm this has worked, use the following command. `nvm --version`. The output should be a version number.
5. [Set default Node.js version](#set-default-nodejs-version)

The output of each of those commands should be a version number. Your versions may not be the same as those shown below! If entering those commands doesn’t show you a version number, go back and make sure you have installed Node.js.
#### Fedora, RedHat, and other `dnf` based distros:

1. These distros come installed with curl, so you can use that to download nvm.
`curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash`
2. To confirm this has worked, use the following command. `nvm --version`. The output should be a version number.
3. [Set default Node.js version](#set-default-nodejs-version)

If the Linux distribution you are using is not listed here, please find instructions on the web.

#### Set default Node.js version

When nvm is installed, it does not default to a particular node version. You’ll need to install the version you want and give nvm instructions to use it. This example uses the latest release of version 10, but more recent version numbers can be used instead.

```shell
nvm install 10
nvm use 10
```

To confirm that this worked, you can run `npm --version` and `node --version`. The output should look similar to the screenshot below, showing version numbers in response to the commands.

![Check node and npm versions in terminal](01-node-npm-versions.png)

Once you have followed the installation steps and you have checked everything is installed properly, you can continue to the next step.

## Install Git

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. When you install a Gatsby "starter" site, Gatsby uses Git behind the scenes to download and install the required files for your starter. You will need to have Git installed to set up your first Gatsby site.
Expand Down

0 comments on commit e89d3f3

Please sign in to comment.