Gitbook 安装

文章目录

  • Gitbook 安装
    • 1. node & npm 安装
    • 2. gitbook 安装
    • 3. gitbook 创建

1. node & npm 安装

第一种方法

cd /usr/local
wget https://nodejs.org/dist/v10.24.0/node-v10.24.0-linux-x64.tar.gz
tar -zxvf node-v10.24.0-linux-x64.tar.gz
ln -s /usr/local/node-v10.24.0-linux-x64/bin/node /usr/local/bin/
ln -s /usr/local/node-v10.24.0-linux-x64/bin/npm /usr/local/bin/
node -v
npm -v

第二种方法:

$ nvm install v10.24.0
Downloading and installing node v10.24.0...
Downloading https://nodejs.org/dist/v10.24.0/node-v10.24.0-linux-x64.tar.xz...
############################################################################################################################################################################################################################ 100.0%Computing checksum with sha256sum
Checksums matched!
Now using node v10.24.0 (npm v6.14.11)
Creating default alias: default -> v10.24.0
$ npm -v
6.14.11
$ node -v
v10.24.0

nodejs 安装 node一定要安装10.X版本,否则报如下错误:

CLI version: 2.3.2
Installing GitBook 3.2.3
/usr/local/node/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287if (cb) cb.apply(this, arguments)^TypeError: cb.apply is not a functionat /usr/local/node/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18at FSReqCallback.oncomplete (fs.js:193:5)

系统:ubuntu:18.04

2. gitbook 安装

$ npm install gitbook-cli -g
/usr/local/node/bin/gitbook -> /usr/local/node/lib/node_modules/gitbook-cli/bin/gitbook.js
+ gitbook-cli@2.3.2
added 578 packages from 672 contributors in 191.662s#找到gitbook命令位置
$ ls /usr/local/node-v10.24.0-linux-x64/bin/
gitbook            node               node_modules/      npm                npx                package-lock.json#添加软连接
$ ln -s /usr/local/node-v10.24.0-linux-x64/bin/gitbook /usr/local/bin/$npm install -g gitbook-summary #安装book命令
$ ln -s /usr/local/node-v10.24.0-linux-x64/bin/book /usr/local/bin/$ gitbook -V
CLI version: 2.3.2
Installing GitBook 3.2.3
gitbook@3.2.3 ../../../../tmp/tmp-117466TKiRhUq3ov0O/node_modules/gitbook
├── escape-html@1.0.3
├── escape-string-regexp@1.0.5
├── destroy@1.0.4
├── ignore@3.1.2
├── bash-color@0.0.4
├── gitbook-plugin-livereload@0.0.1
├── cp@0.2.0
├── nunjucks-do@1.0.0
├── graceful-fs@4.1.4
├── github-slugid@1.0.1
├── direction@0.1.5
├── q@1.4.1
├── spawn-cmd@0.0.2
├── gitbook-plugin-fontsettings@2.0.0
├── open@0.0.5
├── is@3.3.0
├── object-path@0.9.2
├── extend@3.0.2
├── json-schema-defaults@0.1.1
├── gitbook-plugin-search@2.2.1
├── jsonschema@1.1.0
├── crc@3.4.0
├── urijs@1.18.0
├── semver@5.1.0
├── immutable@3.8.2
├── front-matter@2.3.0
├── npmi@2.0.1 (semver@4.3.6)
├── resolve@1.1.7
├── gitbook-plugin-theme-default@1.0.7
├── moment@2.13.0
├── npm@3.9.2
├── dom-serializer@0.1.0 (domelementtype@1.1.3, entities@1.1.2)
├── tmp@0.0.28 (os-tmpdir@1.0.2)
├── error@7.0.2 (xtend@4.0.2, string-template@0.2.1)
├── omit-keys@0.1.0 (isobject@0.2.0, array-difference@0.0.1)
├── mkdirp@0.5.1 (minimist@0.0.8)
├── js-yaml@3.14.1 (esprima@4.0.1, argparse@1.0.10)
├── gitbook-plugin-lunr@1.2.0 (html-entities@1.2.0, lunr@0.5.12)
├── gitbook-plugin-highlight@2.0.2 (highlight.js@9.2.0)
├── gitbook-plugin-sharing@1.0.2 (lodash@3.10.1)
├── i18n-t@1.0.1 (lodash@4.17.21)
├── gitbook-markdown@1.3.2 (kramed-text-renderer@0.2.1, gitbook-html@1.3.3, kramed@0.5.6, lodash@4.17.21)
├── gitbook-asciidoc@1.2.2 (gitbook-html@1.3.3, asciidoctor.js@1.5.5-1, lodash@4.17.21)
├── send@0.13.2 (fresh@0.3.0, etag@1.7.0, statuses@1.2.1, range-parser@1.0.3, ms@0.7.1, depd@1.1.2, mime@1.3.4, debug@2.2.0, http-errors@1.3.1, on-finished@2.3.0)
├── fresh-require@1.0.3 (is-require@0.0.1, shallow-copy@0.0.1, astw@1.3.0, acorn@0.9.0, sleuth@0.1.1, escodegen@1.14.3, through2@0.6.5)
├── rmdir@1.2.0 (node.flow@1.2.3)
├── request@2.72.0 (tunnel-agent@0.4.3, aws-sign2@0.6.0, forever-agent@0.6.1, oauth-sign@0.8.2, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0.6, aws4@1.11.0, isstream@0.1.2, json-stringify-safe@5.0.1, tough-cookie@2.2.2, node-uuid@1.4.8, qs@6.1.2, hawk@3.1.3, combined-stream@1.0.8, mime-types@2.1.34, http-signature@1.1.1, form-data@1.0.1, bl@1.1.2, har-validator@2.0.6)
├── read-installed@4.0.3 (debuglog@1.0.1, util-extend@1.0.3, slide@1.1.6, readdir-scoped-modules@1.1.0, read-package-json@2.1.2)
├── cpr@1.1.1 (rimraf@2.4.5)
├── tiny-lr@0.2.1 (parseurl@1.3.3, livereload-js@2.4.0, qs@5.1.0, debug@2.2.0, faye-websocket@0.10.0, body-parser@1.14.2)
├── cheerio@0.20.0 (entities@1.1.2, lodash@4.17.21, css-select@1.2.0, htmlparser2@3.8.3, jsdom@7.2.2)
├── juice@2.0.0 (deep-extend@0.4.2, slick@1.12.2, batch@0.5.3, cssom@0.3.1, cross-spawn-async@2.2.5, commander@2.9.0, web-resource-inliner@2.0.0)
├── chokidar@1.5.0 (async-each@1.0.3, path-is-absolute@1.0.1, inherits@2.0.4, glob-parent@2.0.0, is-glob@2.0.1, is-binary-path@1.0.1, anymatch@1.3.2, readdirp@2.2.1)
└── nunjucks@2.5.2 (asap@2.0.6, yargs@3.32.0, chokidar@1.7.0)
GitBook version: 3.2.3

3. gitbook 创建

$ mkdir gitbook-demo
$ cd gitbook-demo#使用 gitbook init 初始化书籍目录
$ gitbook init
warn: no summary file in this book
info: create README.md
info: create SUMMARY.md
info: initialization is finished $ ls
README.md  SUMMARY.md
#使用 gitbook build 编译书籍
$ gitbook build
info: 7 plugins are installed
info: 6 explicitly listed
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 1 pages
info: found 0 asset files
info: >> generation finished with success in 0.4s ! $ ls
_book  README.md  SUMMARY.md$ ls _book/
gitbook  index.html  search_index.json$ ls _book/gitbook/
fonts  gitbook.js  gitbook-plugin-fontsettings  gitbook-plugin-highlight  gitbook-plugin-lunr  gitbook-plugin-search  gitbook-plugin-sharing  images  style.css  theme.js#使用 gitbook serve 编译并预览书籍
$ gitbook serve
Live reload server started on port: 35729
Press CTRL+C to quit ...info: 7 plugins are installed
info: loading plugin "livereload"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 1 pages
info: found 0 asset files
info: >> generation finished with success in 0.5s ! Starting server ...
Serving book on http://localhost:4000

效果

图中侧栏Introduction的内容正是README.md的内容,SUMMARY.md 是编写界面侧栏的目录结构。

$ cat README.md
# Introduction$ cat SUMMARY.md
# Summary* [Introduction](README.md)

gitbook 安装相关推荐

  1. gitbook安装与使用之windows下搭建gitbook平台

    最近需要在GitBook中去阅读电子书 安装nodejs cnpm安装gitbook 解压书籍文件,并cd到书籍文件目录 gitbook serve 浏览器访问localhost:4000 先在win ...

  2. gitbook安装与使用

    废话不说,直接主题: gitbook安装 =========== 1. 安装npm  从网站 https://nodejs.org/#download 下载node.js源代码(点击绿色的INSTAL ...

  3. gitbook安装使用看完这一篇就够了

    Gitbook使用教程 GitBook安装 GitBook是一个能将使用 Markdown 语法,快速制作成各种格式电子书的工具.它是一个基于 Node.js 的命令行工具,可以用来制作精美的电子书. ...

  4. gitbook 安装使用

    概述 GitBook 是使用 GitHub / Git 和 Markdown(或AsciiDoc)构建漂亮书籍的命令行工具(和Node.js库). GitBook 可以将您的内容作为网站(可定制和可扩 ...

  5. Gitbook安装及用法

    Gitbook安装及用法 文章目录 Gitbook安装及用法 1.环境要求 2.安装 npm简介(可跳过) 3.编辑器 4.创建一本书 创建书 目录结构 SUMMARY.MD book.json pd ...

  6. Gitbook安装与设置

    Windows系统 安装 Gitbook 需要 nodejs 环境,请事先安装并配置 nodejs 环境,这里就不多做讲解了,您可以移步到作者的相关文章中查看:使用nvm管理node和npm 和 解压 ...

  7. gitbook安装与使用(含常用插件和book.json配置详解)

    本文是我的个人网站G笔记中的内容,最新的内容可访问G笔记 GitBook 安装教程 下面将介绍本地如何安装GitBook 环境要求 node版本要求:V4.0.0以上 通过npm安装 执行命令: np ...

  8. gitbook安装教程

    文章目录 前言介绍 一.nodejs安装配置 1.1 安装 1.2 镜像配置 二.本地gitbook安装配置 2.1 切换到D盘 2.2 安装gitbook-cli 2.3 查看版本 2.4 初始化g ...

  9. 新版GitBook安装及使用——不完全避坑指南

    最近打算把一些笔记进行电子化整理和归档,于是尝试了 GitBook. GitBook 是目前最流行的开源书籍写作方案,可以把Markdown 文件汇集成电子书,并提供 PDF.HTML 等多种格式输出 ...

最新文章

  1. 虚拟文件系统(VFS)
  2. python从外部传入参数_从另一个Python脚本运行一个Python脚本,并传入参数 - python...
  3. perl语言入门第七版中文_网站编程语言的选择
  4. VS2010 自动化整理代码(1)--- VS正则表达替换 PK Vim
  5. 一般二叉树的顺序存储Java_100-顺序存储二叉树思路图解
  6. u盘检测工具哪个好用_惠普打印机哪个型号好 惠普打印机型号介绍【推荐】
  7. 今日头条成锤子“接盘侠”?“是真的!”
  8. flask mysql pymysql_在 flask 中使用 pymysql 报错,望大神解答!感激不尽!
  9. 【渝粤教育】国家开放大学2018年秋季 0676-22T物流成本管理 参考试题
  10. 过拟合和欠拟合_TensorFlow教程-过拟合和欠拟合
  11. 74系列芯片功能说明
  12. WPS 删除线快捷键
  13. Ubuntu安装Mysql5.7
  14. linux免费日志分析工具,分享10个优秀的日志分析工具
  15. debian10编译安装mysql
  16. CSS中相对定位relative
  17. 算法与数据结构 - 数组详解
  18. 计算机组成原理扩展指令CLC实验报告,计算机组成原理实验报告.doc
  19. win10pe系统计算机名修改,Win10怎么修改账户名?|Win10怎么改用户名称?
  20. c#往结构体里面读数据_C# 结构体和ListT类型数据转Json数据保存和读取

热门文章

  1. Windows下DOS进入指定路径
  2. dumpsys activity 相关命令解析
  3. 杰奇1.7用php53,杰奇1.7小说系统多模版一库教程
  4. 【锐捷交换】接入交换机安全配置
  5. sql 导入linux问题:ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-m
  6. JN项目-对社团申请进行排序,按照申请时间和审核时间降序
  7. MySql自动增长从头开始
  8. python笑傲江湖_PHP 2019年继续笑傲江湖
  9. 计算机网络之计算机网络概述
  10. 2021年起重机司机(限桥式起重机)考试题库及起重机司机(限桥式起重机)理论考试