Solve gitbook rangeerror: maximum call stack size exceeded

Problem description
Gitbook serve preview: error RangeError: Maximum call stack size exceeded

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

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
        }
    }
}

Json is created in the root directory of the GitBook project, and the lunr plug-in is disabled

$ 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"]
}

Preview again to see if there are any errors

At this point, there is no problem with using gitbook serve, but using gitbook build --gitbook=2.6.7 still gives an error.
Use gitbook Build –gitbook=2.6.7 Still gives an error

When using gitbook build only, the error will not be reported, while when making gitbook version, the error will be reported, indicating that lunr plug-in is not disabled when making the version.
Therefore, this approach does not solve this reduced version of gitbook build case.

Read More: