summaryrefslogtreecommitdiffstats
path: root/docs/setup.md
blob: ce5e0ca790a5e3dad868f228390fa9f5af5126b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Setup and Installation of GitBook

Getting GitBook installed and ready-to-go should only take a few minutes.

This page describe the process for running the toolchain locally. The easiest for writing and hosting your content is to use [GitBook.com](https://www.gitbook.com) and the [GitBook Editor](https://www.gitbook.com/editor).

### Requirements

Installing GitBook is easy and straightforward. Your system just needs to meet these two requirements:

* Node.js (v4.0.0 and above is recommended)
* Windows, Linux, Unix, or Mac OS X

### Install with NPM

The best way to install GitBook is via **NPM** (or **Yarn**). At the terminal prompt, simply run the following command to install GitBook:

```
$ npm install gitbook-cli -g
```

`gitbook-cli` is an utility to install and use multiple versions of GitBook on the same system. It will automatically install the required version of GitBook to build a book.

### Create a book

GitBook can setup a boilerplate book:

```
$ gitbook init
```

If you wish to create the book into a new directory, you can do so by running `gitbook init ./directory`

### Preview your website

Preview and serve your book using:

```
$ gitbook serve
```

Or build the static website using:

```
$ gitbook build
```

### Install pre-releases

`gitbook-cli` makes it easy to download and install other versions of GitBook to test with your book:

```
$ gitbook fetch beta
```

Use `gitbook ls-remote` to list remote versions available for install.

### Debugging

You can use the options `--log=debug` and `--debug` to get better error messages (with stack trace). For example:

```
$ gitbook build ./ --log=debug --debug
```