Tips:前导摘要:记得有一次不小心卸载了一个东西,后面执行gitbook init报错:Cannot find module 'internal/util/types

官方GitHub:https://github.com/GitbookIO/gitbook-cli

一、卸载GitBook(没有安装的跳过此步骤)

找到C:\Users\{User}\.gitbook 找到并删除此文件夹

删除后执行命令

# npm uninstall -g gitbook
# npm uninstall -g gitbook-cli
--- 清除npm缓存
# npm cache clean -f

二、安装GitBook

需要node环境 ➡️ Linux或Win下安装node和npm
需要Git环境 ➡️ https://www.jianshu.com/p/f2da5e76a588

# npm install gitbook -g
# npm install -g gitbook-cli
--- 如果没有安装gitbook,此命令会默认同时安装 GitBook
# gitbook -V
--- 列出本地所有的gitbook版本
# gitbook ls
Tips:GitBook常用命令
  • 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上的可用版本:

三、GitBook常见错误
GitBook的安装、卸载、常见问题_github
image.png

四、作者寄语

Everything is ok. But you have to do by yourself.