Gitbook安装

    切记在执行这个安装命令前,有:

    1. 设置nodejs的仓库
    2. 在linux下,请将 加入PATH
    3. 在windows下,请务必在windows的 cmd 命令行下执行上述npm install 命令,不要在linux shell下(比如安装git之后的shell)安装,否则执行gitbook 总是会报错:

      1. You need to install "gitbook-cli" to have access to the gitbook command anywhere on your system.
      2. If you've installed this package globally, you need to uninstall it.

    通过下列命令安装 grunt 和 grunt-cli

    1. npm install -g grunt grunt-cli

    进入任何一本 gitbook 的书籍,执行 gitbook serve 命令,第一次执行时会初始化 GitBook:

    1. sky@skylinux ~/work/code/leaning/leaning-gitbook $ gitbook serve
    2. Installing GitBook 3.2.2
    3. gitbook@3.2.2 ../../../../../../tmp/tmp-109965s9a5ZM8Xffp/node_modules/gitbook
    4. ├── escape-html@1.0.3
    5. ├── escape-string-regexp@1.0.5
    6. ├── destroy@1.0.4
    7. └── npm@3.9.2
    8. Press CTRL+C to quit ...
    9. info: 7 plugins are installed
    10. info: loading plugin "livereload"... OK
    11. info: loading plugin "highlight"... OK
    12. ......
    13. Serving book on http://localhost:4000

    这个初始化工作只会做一次,之后再运行,哪怕是在其他书籍目录下执行,也不需要再初始化。