问题描述

在编写Gitbook的过程中,在启动​​gitbook serve​​​预览的时候,发生了错误​​RangeError: Maximum call stack size exceeded​​。





解决GitBook RangeError: Maximum call stack size exceeded_git


解决方案

​https://github.com/GitbookIO/plugin-lunr/blob/master/README.md#limitations​




解决GitBook RangeError: Maximum call stack size exceeded_json_02


lunr

This plugin provides a backend for the ​​search​​ plugin.

This plugin is a default plugin.

Disable this plugin

This is a default plugin and it can be disabled using a ​​book.json​​ configuration:

{
"plugins": ["-lunr"]
}

Limitations

Lunr can't index a huge book, by default the index size is limited at ~100ko.

You can change this limit by settings the configuration ​​maxIndexSize​​:

{
"pluginsConfig": {
"lunr": {
"maxIndexSize": 200000
}
}
}

在GitBook项目的根目录创建​​book.json​​​,禁用​​lunr​​插件

$ vim book.json

$ ls
_book/ Chapter10/ Chapter3/ Chapter6/ Chapter9/
book.json Chapter11/ Chapter4/ Chapter7/ README.md
Chapter1/ Chapter2/ Chapter5/ Chapter8/ SUMMARY.md

$ cat book.json
{
"plugins": ["-lunr"]
}

再次启动预览看看还有没报错




解决GitBook RangeError: Maximum call stack size exceeded_解决方案_03


此时,使用​​gitbook serve​​​已经没有问题了,但是使用​​gitbook build --gitbook=2.6.7​​依然报错。

使用gitbook build --gitbook=2.6.7 依然报错




解决GitBook RangeError: Maximum call stack size exceeded_解决方案_04


单纯使用​​gitbook build​​​的时候不会报错,而制定​​gitbook​​​ 版本导出的时候则报错,说明制定版本的时候,并没有禁用​​lunr​​插件。

所以,这种方法不能解决这种降低版本的​​gitbook build​​的情况。




解决GitBook RangeError: Maximum call stack size exceeded_解决方案_05