之前自己写的:
现在在另外Mac中,尝试恢复环境。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | xxx@xxx ~ /dev/crifan/gitbook git clone https: //github .com /crifan/gitbook_template .git Cloning into 'gitbook_template' ... remote: Enumerating objects: 104, done . remote: Total 104 (delta 0), reused 0 (delta 0), pack-reused 104 Receiving objects: 100% (104 /104 ), 1.30 MiB | 638.00 KiB /s , done . Resolving deltas: 100% (28 /28 ), done . xxx@xxx ~ /dev/crifan/gitbook cd gitbook_template xxx@xxx ~ /dev/crifan/gitbook/gitbook_template/books master cd gitbook_demo xxx@xxx ~ /dev/crifan/gitbook/gitbook_template/books/gitbook_demo master ll total 40 -rw-r--r-- 1 xxx CORP\Domain Users 40B 3 17 09:11 Makefile -rw-r--r-- 1 xxx CORP\Domain Users 1.5K 3 17 09:11 README.md -rw-r--r-- 1 xxx CORP\Domain Users 233B 3 17 09:11 README_current.json -rw-r--r-- 1 xxx CORP\Domain Users 3.0K 3 17 09:11 book.json -rw-r--r-- 1 xxx CORP\Domain Users 456B 3 17 09:11 book_current.json lrwxr-xr-x 1 xxx CORP\Domain Users 36B 3 17 09:11 node_modules -> ../.. /generated/gitbook/node_modules drwxr-xr-x 9 xxx CORP\Domain Users 288B 3 17 09:11 src |
此处目前还没gitbook命令行工具
1 2 | which gitbook gitbook not found |
所以要去安装
mac gitboo cli
1 | npm install -g gitbook-cli |
log
1 2 3 4 5 6 7 8 9 10 11 12 13 | npm install -g gitbook-cli /usr/local/bin/gitbook -> /usr/local/lib/node_modules/gitbook-cli/bin/gitbook .js + gitbook-cli@2.3.2 added 578 packages from 672 contributors in 9.723s ╭────────────────────────────────────────────────────────────────╮ │ │ │ New minor version of npm available! 6.13.4 → 6.14.2 │ │ Changelog: https: //github .com /npm/cli/releases/tag/v6 .14.2 │ │ Run npm install -g npm to update! │ │ │ ╰────────────────────────────────────────────────────────────────╯ |

可以找到了:
1 2 | which gitbook /usr/local/bin/gitbook |
去看看版本:
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 | gitbook --version CLI version: 2.3.2 Installing GitBook 3.2.3 gitbook@3.2.3 ../../../../../../../.. /var/folders/gt/5868sbcd1jq4rxvryqhy2_1sz8n0s3/T/tmp-11660s4Xx0UYPCvVc/node_modules/gitbook ├── escape-string-regexp@1.0.5 ├── escape-html@1.0.3 ├── destroy@1.0.4 ├── ignore@3.1.2 ├── bash -color@0.0.4 ├── gitbook-plugin-livereload@0.0.1 ├── cp @0.2.0 ├── graceful-fs@4.1.4 ├── nunjucks- do @1.0.0 ├── 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 ├── semver@5.1.0 ├── urijs@1.18.0 ├── immutable@3.8.2 ├── front-matter@2.3.0 ├── dom-serializer@0.1.0 (domelementtype@1.1.3, entities@1.1.2) ├── error@7.0.2 (xtend@4.0.2, string-template@0.2.1) ├── tmp@0.0.28 (os-tmpdir@1.0.2) ├── npmi@2.0.1 (semver@4.3.6) ├── omit-keys@0.1.0 (isobject@0.2.0, array-difference@0.0.1) ├── send@0.13.2 (etag@1.7.0, fresh@0.3.0, range-parser@1.0.3, statuses@1.2.1, 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) ├── mkdirp@0.5.1 (minimist@0.0.8) ├── resolve@1.1.7 ├── rmdir @1.2.0 (node.flow@1.2.3) ├── fresh-require@1.0.3 (is-require@0.0.1, shallow-copy@0.0.1, sleuth@0.1.1, astw@1.3.0, through2@0.6.5, acorn@0.9.0, escodegen@1.14.1) ├── gitbook-plugin-theme-default@1.0.7 ├── js-yaml@3.13.1 (esprima@4.0.1, argparse@1.0.10) ├── tiny-lr@0.2.1 (parseurl@1.3.3, livereload-js@2.4.0, qs@5.1.0, debug@2.2.0, body-parser@1.14.2, faye-websocket@0.10.0) ├── cpr@1.1.1 (rimraf@2.4.5) ├── gitbook-plugin-lunr@1.2.0 (html-entities@1.2.0, lunr@0.5.12) ├── 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.1) ├── gitbook-plugin-highlight@2.0.2 (highlight.js@9.2.0) ├── moment@2.13.0 ├── gitbook-plugin-sharing@1.0.2 (lodash@3.10.1) ├── i18n-t@1.0.1 (lodash@4.17.15) ├── gitbook-asciidoc@1.2.2 (gitbook-html@1.3.3, asciidoctor.js@1.5.5-1, lodash@4.17.15) ├── gitbook-markdown@1.3.2 (kramed-text-renderer@0.2.1, gitbook-html@1.3.3, kramed@0.5.6, lodash@4.17.15) ├── cheerio@0.20.0 (entities@1.1.2, css- select @1.2.0, htmlparser2@3.8.3, jsdom@7.2.2, lodash@4.17.15) ├── request@2.72.0 (tunnel-agent@0.4.3, aws-sign2@0.6.0, oauth-sign@0.8.2, forever-agent@0.6.1, caseless@0.11.0, is-typedarray@1.0.0, stringstream@0.0.6, aws4@1.9.1, isstream@0.1.2, json-stringify-safe@5.0.1, tough-cookie@2.2.2, node-uuid@1.4.8, qs@6.1.2, combined-stream@1.0.8, mime-types@2.1.26, bl@1.1.2, hawk@3.1.3, har-validator@2.0.6, http-signature@1.1.1, form-data@1.0.1) ├── nunjucks@2.5.2 (asap@2.0.6, yargs@3.32.0, chokidar@1.7.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) ├── juice@2.0.0 (deep-extend@0.4.2, slick@1.12.2, batch@0.5.3, cssom@0.3.1, commander@2.9.0, cross-spawn-async@2.2.5, web-resource-inliner@2.0.0) └── npm@3.9.2 GitBook version: 3.2.3 |
然后换个目录,重新打开终端,看看能否找到
1 2 3 4 5 | xxx@xxx ~ which gitbook /usr/local/bin/gitbook xxx@xxx ~ gitbook --version CLI version: 2.3.2 GitBook version: 3.2.3 |
正常了。
再去安装插件
1 | make install |
试试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | master make install - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Author : crifan.com Version : 20190627 Function: Auto use gitbook to generated files: website / pdf / epub / mobi; upload to remote server; commit to github io repo Run 'make help' to see usage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CURRENT_DIR = / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo BOOK_NAME = gitbook_demo NOT found gitbook_demo in IGNORE_FILE_CONTENT = gitbook install info: installing 17 plugins using npm@ 3.9 . 2 info: info: installing plugin "theme-comscore" info: install plugin "theme-comscore" ( * ) from NPM with version 0.0 . 3 / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo └── gitbook - plugin - theme - comscore@ 0.0 . 3 Error: EEXIST: file already exists, mkdir '/Users/xxx/dev/crifan/gitbook/gitbook_template/books/gitbook_demo/node_modules' make: * * * [install] Error 1 |

对了,是因为此处已有软连接,所以没法新建node_modules。
先把这个ln的软链接删了:
1 2 3 4 5 6 7 8 9 | ✘ xxx@xx ~ /dev/crifan/gitbook/gitbook_template/books/gitbook_demo master rm -f node_modules xxx@xx ~ /dev/crifan/gitbook/gitbook_template/books/gitbook_demo master ● ll total 40 -rw-r--r-- 1 xxx CORP\Domain Users 40B 3 17 09:11 Makefile -rw-r--r-- 1 xxx CORP\Domain Users 1.5K 3 17 09:11 README.md -rw-r--r-- 1 xxx CORP\Domain Users 233B 3 17 09:11 README_current.json -rw-r--r-- 1 xxx CORP\Domain Users 3.0K 3 17 09:11 book.json -rw-r--r-- 1 xxx CORP\Domain Users 456B 3 17 09:11 book_current.json drwxr-xr-x 9 xxx CORP\Domain Users 288B 3 17 09:11 src |
再去安装:
1 | make install |
看起来安装很慢,所以:
【未解决】Mac中给gitbook install安装代理或更换源以提高下载速度
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | make install - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Author : crifan.com Version : 20190627 Function: Auto use gitbook to generated files: website / pdf / epub / mobi; upload to remote server; commit to github io repo Run 'make help' to see usage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CURRENT_DIR = / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo BOOK_NAME = gitbook_demo NOT found gitbook_demo in IGNORE_FILE_CONTENT = gitbook install info: installing 17 plugins using npm@ 3.9 . 2 info: info: installing plugin "theme-comscore" info: install plugin "theme-comscore" ( * ) from NPM with version 0.0 . 3 info: >> plugin "theme-comscore" installed with success info: info: installing plugin "anchors" info: install plugin "anchors" ( * ) from NPM with version 0.7 . 1 / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo ├─┬ gitbook - plugin - anchors@ 0.7 . 1 │ ├─┬ cheerio@ 0.22 . 0 │ │ ├─┬ css - select@ 1.2 . 0 │ │ │ ├── boolbase@ 1.0 . 0 │ │ │ ├── css - what@ 2.1 . 3 │ │ │ ├── domutils@ 1.5 . 1 │ │ │ └── nth - check@ 1.0 . 2 │ │ ├─┬ dom - serializer@ 0.1 . 1 │ │ │ └── domelementtype@ 1.3 . 1 │ │ ├── entities@ 1.1 . 2 │ │ ├─┬ htmlparser2@ 3.10 . 1 │ │ │ ├── domhandler@ 2.4 . 2 │ │ │ ├── inherits@ 2.0 . 4 │ │ │ └─┬ readable - stream@ 3.6 . 0 │ │ │ ├─┬ string_decoder@ 1.3 . 0 │ │ │ │ └── safe - buffer @ 5.2 . 0 │ │ │ └── util - deprecate@ 1.0 . 2 │ │ ├── lodash.assignin@ 4.2 . 0 │ │ ├── lodash.bind@ 4.2 . 1 │ │ ├── lodash.defaults@ 4.2 . 0 │ │ ├── lodash. filter @ 4.6 . 0 │ │ ├── lodash.flatten@ 4.4 . 0 │ │ ├── lodash.foreach@ 4.5 . 0 │ │ ├── lodash. map @ 4.6 . 0 │ │ ├── lodash.merge@ 4.6 . 2 │ │ ├── lodash.pick@ 4.4 . 0 │ │ ├── lodash. reduce @ 4.6 . 0 │ │ ├── lodash.reject@ 4.6 . 0 │ │ └── lodash.some@ 4.6 . 0 │ └── github - slugid@ 1.0 . 1 └── gitbook - plugin - theme - comscore@ 0.0 . 3 info: >> plugin "anchors" installed with success ... info: >> plugin "callouts" installed with success info: info: installing plugin "toolbar-button" runTopLevelLifecycles → 2 ▌ ╢██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████░░░░░╟ / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo ├── gitbook - plugin - anchors@ 0.7 . 1 ├─┬ gitbook - plugin - callouts@ 0.1 . 1 │ └─┬ cheerio@ 0.19 . 0 │ └─┬ htmlparser2@ 3.8 . 3 │ └── domutils@ 1.5 . 1 ├── gitbook - plugin - copy - code - button@ 0.0 . 2 ├── gitbook - plugin - disqus@ 0.1 . 0 ├── gitbook - plugin - donate@ 1.0 . 2 ├── gitbook - plugin - expandable - chapters - small@ 0.1 . 7 ├── gitbook - plugin - ga@ 1.0 . 1 ├── gitbook - plugin - github - buttons@ 3.0 . 0 ├── gitbook - plugin - prism@ 2.4 . 0 ├── gitbook - plugin - prism - themes@ 0.0 . 2 ├── gitbook - plugin - search - plus@ 1.0 . 3 ├── gitbook - plugin - sharing - plus@ 0.0 . 2 ├── gitbook - plugin - sitemap - general@ 0.1 . 1 ├── gitbook - plugin - splitter@ 0.0 . 8 ├── gitbook - plugin - tbfed - pagefooter@ 0.0 . 1 ├── gitbook - plugin - theme - comscore@ 0.0 . 3 └── gitbook - plugin - toolbar - button@ 0.0 . 1 info: >> plugin "toolbar-button" installed with success |
安装完毕了。
1 2 3 4 5 6 7 8 9 | ● ll total 40 -rw-r--r-- 1 xxx CORP\Domain Users 40B 3 17 09:11 Makefile -rw-r--r-- 1 xxx CORP\Domain Users 1.5K 3 17 09:11 README.md -rw-r--r-- 1 xxx CORP\Domain Users 233B 3 17 09:11 README_current.json -rw-r--r-- 1 xxx CORP\Domain Users 3.0K 3 17 09:11 book.json -rw-r--r-- 1 xxx CORP\Domain Users 456B 3 17 09:11 book_current.json drwxr-xr-x 66 xxx CORP\Domain Users 2.1K 3 17 10:07 node_modules drwxr-xr-x 9 xxx CORP\Domain Users 288B 3 17 09:41 src |
后续再把node_modules移动到 generated
以及再去make debug看看
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | make debug - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Author : crifan.com Version : 20190627 Function: Auto use gitbook to generated files: website / pdf / epub / mobi; upload to remote server; commit to github io repo Run 'make help' to see usage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CURRENT_DIR = / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo BOOK_NAME = gitbook_demo NOT found gitbook_demo in IGNORE_FILE_CONTENT = rm - f book.json rm - f README.md Complete load json from / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / README_current.json Complete save file / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / README.md cp README.md . / src / README.md cp / Users / xxx / dev / crifan / gitbook / gitbook_template / common / config / common / common_gitignore .gitignore Complete sync content rm - rf / Users / xxx / dev / crifan / gitbook / gitbook_template / generated / books / gitbook_demo / debug mkdir - p / Users / xxx / dev / crifan / gitbook / gitbook_template / generated / books / gitbook_demo / debug gitbook serve / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / Users / xxx / dev / crifan / gitbook / gitbook_template / generated / books / gitbook_demo / debug - - log debug Live reload server started on port: 35729 Press CTRL + C to quit ... debug: readme found at README.md debug: summary file found at SUMMARY.md debug: cleanup folder "/Users/xxx/dev/crifan/gitbook/gitbook_template/generated/books/gitbook_demo/debug" info: 24 plugins are installed info: 20 explicitly listed info: loading plugin "anchors" ... OK info: loading plugin "search-plus" ... OK info: loading plugin "disqus" ... OK info: loading plugin "prism" ... OK info: loading plugin "prism-themes" ... OK info: loading plugin "github-buttons" ... OK info: loading plugin "splitter" ... OK info: loading plugin "sharing-plus" ... OK info: loading plugin "tbfed-pagefooter" ... OK info: loading plugin "expandable-chapters-small" ... OK info: loading plugin "ga" ... OK info: loading plugin "donate" ... OK info: loading plugin "sitemap-general" ... OK info: loading plugin "copy-code-button" ... OK info: loading plugin "callouts" ... OK info: loading plugin "toolbar-button" ... OK info: loading plugin "livereload" ... OK info: loading plugin "fontsettings" ... OK info: loading plugin "theme-comscore" ... OK info: loading plugin "theme-default" ... OK info: found 11 pages info: found 2 asset files debug: calling hook "config" debug: calling hook "init" warn: "options" property is deprecated, use config.get(key) instead warn: "options.generator" property is deprecated, use "output.name" instead init! debug: copy assets from theme / Users / xxx / .gitbook / versions / 3.2 . 3 / node_modules / gitbook - plugin - theme - default / _assets / website debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - theme - comscore / book debug: copy resources from plugin / Users / xxx / .gitbook / versions / 3.2 . 3 / node_modules / gitbook - plugin - fontsettings / assets debug: copy resources from plugin / Users / xxx / .gitbook / versions / 3.2 . 3 / node_modules / gitbook - plugin - livereload / book debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - toolbar - button / book debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - callouts / book debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - copy - code - button / book debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - donate / assets debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - ga / book debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - expandable - chapters - small / book debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - tbfed - pagefooter / assets debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - sharing - plus / assets debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - splitter / book debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - github - buttons / lib debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / prism - themes / themes debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - disqus / book debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - search - plus / assets debug: copy resources from plugin / Users / xxx / dev / crifan / gitbook / gitbook_template / books / gitbook_demo / node_modules / gitbook - plugin - anchors / assets debug: copy asset "assets/favicon.ico" debug: copy asset "assets/img/crifan_github_home.png" debug: generate page "README.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page README.md debug: generate page "chapter_1/README.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page chapter_1 / README.md debug: generate page "chapter_2/README.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page chapter_2 / README.md debug: generate page "chapter_2/ch2_section_1.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page chapter_2 / ch2_section_1.md debug: generate page "chapter_2/ch2_section_2.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page chapter_2 / ch2_section_2.md debug: generate page "chapter_3/README.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page chapter_3 / README.md debug: generate page "chapter_3/ch3_structure_list.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page chapter_3 / ch3_structure_list.md debug: generate page "chapter_3/ch3_hint_callout.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page chapter_3 / ch3_hint_callout.md debug: generate page "chapter_3/ch3_code_highlight.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page chapter_3 / ch3_code_highlight.md debug: generate page "appendix/README.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page appendix / README.md debug: generate page "appendix/reference.md" debug: calling hook "page:before" debug: calling hook "page" debug: index page appendix / reference.md debug: calling hook "finish:before" debug: calling hook "finish" debug: write search index finish! info: >> generation finished with success in 1.4s ! Starting server ... Serving book on http: / / localhost: 4000 |

然后浏览器中打开
可以看到我们要的gitbook电子书网页了:

至此,本地恢复gitbook的开发环境,就完成了。
剩下的就是写内容了。
不过,顺带还是去把node_modules,移动到公共位置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ✘ xxx@xx ~ /dev/crifan/gitbook/gitbook_template/books/gitbook_demo master ● ll ../.. /generated/gitbook xxx@xx ~ /dev/crifan/gitbook/gitbook_template/books/gitbook_demo master ● mv node_modules ../.. /generated/gitbook xxx@xx ~ /dev/crifan/gitbook/gitbook_template/books/gitbook_demo master ● ll total 40 -rw-r--r-- 1 xxx CORP\Domain Users 40B 3 17 09:11 Makefile -rw-r--r-- 1 xxx CORP\Domain Users 1.5K 3 19 09:18 README.md -rw-r--r-- 1 xxx CORP\Domain Users 233B 3 17 09:11 README_current.json -rw-r--r-- 1 xxx CORP\Domain Users 2.9K 3 19 09:18 book.json -rw-r--r-- 1 xxx CORP\Domain Users 456B 3 17 09:11 book_current.json drwxr-xr-x 9 xxx CORP\Domain Users 288B 3 17 09:41 src xxx@xx ~ /dev/crifan/gitbook/gitbook_template/books/gitbook_demo master ● ll ../.. /generated/gitbook total 0 drwxr-xr-x 66 xxx CORP\Domain Users 2.1K 3 17 10:07 node_modules xxx@xx ~ /dev/crifan/gitbook/gitbook_template/books/gitbook_demo master ● ln -s ../.. /generated/gitbook/node_modules node_modules xxx@xx ~ /dev/crifan/gitbook/gitbook_template/books/gitbook_demo master ● ll total 40 -rw-r--r-- 1 xxx CORP\Domain Users 40B 3 17 09:11 Makefile -rw-r--r-- 1 xxx CORP\Domain Users 1.5K 3 19 09:18 README.md -rw-r--r-- 1 xxx CORP\Domain Users 233B 3 17 09:11 README_current.json -rw-r--r-- 1 xxx CORP\Domain Users 2.9K 3 19 09:18 book.json -rw-r--r-- 1 xxx CORP\Domain Users 456B 3 17 09:11 book_current.json lrwxr-xr-x 1 xxx CORP\Domain Users 36B 3 19 09:22 node_modules -> ../.. /generated/gitbook/node_modules drwxr-xr-x 9 xxx CORP\Domain Users 288B 3 17 09:41 src |

即可。
【总结】
此处用自己的gitbook_template,恢复gitbook本地开发环境步骤是:
1 2 3 4 | git clone https: //github .com /crifan/gitbook_template .git cd gitbook_template cd gitbook_demo rm -f node_modules |
安装gitbook命令行工具:
1 | npm install -g gitbook-cli |
很慢,等待安装完成即可。
1 | make install |
内部会调用
1 | gitbook install |
基于此处book.json的配置去安装插件
安装完毕后,本地会多出node_modules文件夹
然后移动到公共位置:
1 2 | mv node_modules ../.. /generated/gitbook ln -s ../.. /generated/gitbook/node_modules node_modules |
即可。
之后即可愉快的:
1 | make debug |
去本地调试和编写gitbook了。