# gitbook安装及使用

  1. 安装 node.js

  2. 安装 gitbook网址 (opens new window)

    npm install -g gitbook-cli
    
  3. 反安装gitbook

    npm uninstall -g gitbook-cli
    
  4. gitbook帮忙信息

    gitbook help
    
  5. 显示 gitbook版本

    gitbook -V
    
  6. 初始化文章目录

    gitbook init
    
  7. 构建文章

    gitbook build
    

    可以跳过5直接运行

  8. 运行文章

    gitbook serve
    

    通过http://localhost:4000可以访问

  9. > gitbook help
        build [book] [output]       build a book
            --log                   Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
            --format                Format to build to (Default is website; Values are website, json, ebook)
            --[no-]timing           Print timing debug information (Default is false)
    
        serve [book] [output]       serve the book as a website for testing
            --port                  Port for server to listen on (Default is 4000)
            --lrport                Port for livereload server to listen on (Default is 35729)
            --[no-]watch            Enable file watcher and live reloading (Default is true)
            --[no-]live             Enable live reloading (Default is true)
            --[no-]open             Enable opening book in browser (Default is false)
            --browser               Specify browser for opening book (Default is )
            --log                   Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
            --format                Format to build to (Default is website; Values are website, json, ebook)
    
        install [book]              install all plugins dependencies
            --log                   Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
    
        parse [book]                parse and print debug information about a book
            --log                   Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
    
        init [book]                 setup and create files for chapters
            --log                   Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
    
        pdf [book] [output]         build a book into an ebook file
            --log                   Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
    
        epub [book] [output]        build a book into an ebook file
            --log                   Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
    
        mobi [book] [output]        build a book into an ebook file
            --log                   Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)