GitBook 编译,生成pdf报错

最近在使用 GitBook 生成静态网页和pdf文件时,百度,谷歌了很久也没有类似的解决方案,最近发现是版本问题,我把我的相关经验分享给大家!

在执行 gitbook build ,gitbook serve,gitbook pdf等命令均保持。报错了错误提示内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
info: 10 plugins are installed
info: 9 explicitly listed
info: loading plugin "baidu"... OK
info: loading plugin "donate"... OK
info: loading plugin "sitemap"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 24 pages
info: found 2 asset files
warn: "options" property is deprecated, use config.get(key) instead
warn: "options.generator" property is deprecated, use "output.name" instead
error: error while generating page "README.md":
TypeError: this.contentPath is not a function

当然也有些网友的报错内容如下:

1
2
3
4
warn: "options" property is deprecated, use config.get(key) instead
warn: "page.progress" property is deprecated
warn: "sections" property is deprecated, use page.content instead
TypeError: Path must be a string. Received undefined

这种问题的原因是,gitbook的版本太低。大家执行 gitbook update 命令进行升级,升级到3.2.2版本即可。

也有网友反映,报一下的错:

1
Error: Couldn't locate plugins "baidu, donate", Run 'gitbook install' to install plugins from registry.

这是提示插件没有安装的错误。大家执行 gitbook install 命令完成安装即可。

上一篇
下一篇