Technical note

GitBook安装

参考文档

安装过程

# npm切换至低版本
npm install -g n
sudo n 10.14.1

# 安装gitbook-cli
npm install -g gitbook-cli

# 查看版本号并自动安装最新版本gitbook
gitbook -V

# 安装低版本的gitbook(可选)
gitbook help
gitbook fetch 2.6.7

常用命令

gitbook -V      查看版本号
gitbook init    初始化
gitbook serve   预览
gitbook build   生成
gitbook build --gitbook=2.6.7 生成时指定gitbook的版本, 本地没有会先下载
gitbook uninstall 2.6.7   卸载指定版本号的gitbook
gitbook fetch [version]      获取[版本]下载并安装<版本>
gitbook --help   显示帮助文档
gitbook ls-remote  列出NPM上的可用版本

错误修复

# 错误
Error loading version latest: Error: Cannot find module 'internal/util/types'

# 修复
I updated npm to the stable version and reinstalled gitbook and it worked
npm cache clean -f
npm install n stable -g
npm cache clean -f
rm -rf ~/.gitbook/*
npm install gitbook-cli -g
gitbook init

本地HTML不能跳转问题

vi theme.js
if(m)for(n.handler&&
将if(m)改成if(false)