Set Up Your Development Environment

Posted byDそんほんすon 2021/05/22カテゴリ:つぶやき

Before you start building your first Gatsby site,
you’ll need to familiarize yourself with some core web technologies and make sure that you have installed all required software tools.


Familiarize yourself with the command line

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 Macinstructions for Windows or instructions for Linux.
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.


Install Node.js for your appropriate operating system

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. 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.
  2. See if Homebrew is installed. You should see “Homebrew” and a version number.
Copy
copy code to clipboard
brew -v
  1. If not, download and install Homebrew with the instructions.
  2. Once you’ve installed Homebrew, repeat step 2 to verify.


Install Xcode Command Line Tools:

  1. Open your Terminal.
  2. Install Xcode Command line tools by running:
Copy
copy code to clipboard
xcode-select --install
💡 If that fails, download it directly from Apple’s site, 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

  1. Open your Terminal
  2. Install node with Homebrew:
Copy
copy code to clipboard
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, double click on the downloaded file and go through the installation process.