easyops-cn / docusaurus-search-local

Offline/local search for Docusaurus v2/v3

Home Page:https://easyops-cn.github.io/docusaurus-search-local/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build with error `Command failed with signal "SIGSEGV"`.

genshen opened this issue · comments

When I use docusaurus-search-local to build my document static site, it raise an error without any more information even if I set DEBUG=search-local:*.

Env

  • OS: Linux docker
  • Arch: amd64
  • docusaurus-search-local: 0.14.2
  • nodejieba: 2.5.1
  • node: 4.15.3

Steps

  1. clone my document project https://github.com/hpcde/cluster-docs and checkout to commit "e74db1218a0607a28d07f998b20355f00bc99b79" if possible.
  2. run docker run -it --rm -v ${PWD}:/root/p --entrypoint ash node:14.15.3-alpine3.12
  3. In docker container, run:
cd /root/p
yarn install
USE_LOCAL_SEARCH=ON yarn build

than there is an error like:

✔ Client
  Compiled successfully in 28.20s

✔ Server
  Compiled successfully in 33.53s

error Command failed with signal "SIGSEGV".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

But, if I disable docusaurus-search-local plugin (just run yarn build), everything works fine.

The SIGSEGV error is probably caused by nodejieba which is a nodejs wrapper of c++ program.

Before I got time to investigate this problem, could you try to set language to ['en'] (without 'zh'), and see whether the problem still exists? Let me know if it works fine or not.

I changed language to ['en'], now it works fine (But I still have the demand of searching Chinese).
It seems that the problem is caused by nodejieba.

Update:
Environment: the same as above, docker image node:14.15.3-alpine3.12

Initialize an empty docusaurus document project using:

npx @docusaurus/init@latest init my-website classic # docusaurus 2.0.0-alpha70
cd my-website

then follow docusaurus-search-local document to add search support:

yarn add @easyops-cn/docusaurus-search-local # v0.14.4
yarn add nodejieba  #2.5.1
vi docusaurus.config.js # set search plugin and add Chinese language support by setting `language: ["en", "zh"],`

Last, build it:

yarn build

It still exit with SIGSEGV error (The above steps work fine on my Mac).

This seems to be a known issue.

I have reproduced the problem. And I also tried to downgrade nodejieba to v2.4.2, It builds successfully. So you can pin nodejieba in your package.json to 2.4.2 (without ^), until nodejieba (or CppJieba) fixed the issue.

Fixed by downgrading nodejieba to v2.4.2.
Thanks for your nice and patient reply👍!