docusaurus-search-local icon indicating copy to clipboard operation
docusaurus-search-local copied to clipboard

After build "Couldn't Found search-index.json" error shows.

Open kaushal0107 opened this issue 2 years ago • 10 comments

kaushal0107 avatar Feb 13 '23 05:02 kaushal0107

Same here. Using: Node 16.18.1 and Docusaurus 2.3.1 Any idea how it could be fixed?

rasgo-cc avatar Mar 09 '23 13:03 rasgo-cc

Same issue here:

GET http://localhost:3000/search-index.json 404 (Not Found)

jon-price-visiontree avatar Mar 23 '23 14:03 jon-price-visiontree

Hello, same here with Docusaurus 2.4.0.

"easyops-cn/docusaurus-search-local" integrated in theme.

After successful build, no search-index.json file generated inside build directory.

Then, searching fails with error 404.

franck-grenier avatar Mar 30 '23 16:03 franck-grenier

Same issue for Docusaurus v2.4.0, search-index.json is not generated after build.

pawhan11 avatar Apr 03 '23 11:04 pawhan11

This PR and its deploy preview generated by renovate bot shows it's working with Docusaurus v2.4.0.

Can anyone facing this issue, provide a repro link?

weareoutman avatar Apr 03 '23 12:04 weareoutman

I was able to narrow the issue down to having routeBasePath: '/' set in @docusaurus/preset-classic config, but also needed to set docsRouteBasePath: '/', to match since I'm running in docs only mode. No more issue after setting that option in the docusaurus-search-local themes config.

jon-price-visiontree avatar Apr 03 '23 14:04 jon-price-visiontree

我能够将问题缩小到routeBasePath: '/'在配置中进行设置@docusaurus/preset-classic,但还需要设置docsRouteBasePath: '/',匹配,因为我在仅文档模式下运行。在主题配置中设置该选项后没有更多问题docusaurus-search-local

Thanks, this tip solved my problem

MrShenhongbo avatar Apr 04 '23 02:04 MrShenhongbo

I was able to narrow the issue down to having routeBasePath: '/' set in @docusaurus/preset-classic config, but also needed to set docsRouteBasePath: '/', to match since I'm running in docs only mode. No more issue after setting that option in the docusaurus-search-local themes config.

Thanks, this solved my issue

pawhan11 avatar Apr 04 '23 08:04 pawhan11

@jon-price-visiontree @pawhan11 can you please attach snippet of the implementation here ?

kaushal0107 avatar Apr 13 '23 09:04 kaushal0107

@kaushal0107 sure, hope this helps :)

Using routeBasePath in @docusaurus/preset-classic config:

presets: [
    [
      'classic',
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          routeBasePath: '/',
          ...
        },
      }),
    ],
  ],

Using docusaurus-search-local themes config: See description

themes: [
    [
      require.resolve('@easyops-cn/docusaurus-search-local'),
      /** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
      {
        docsRouteBasePath: '/',
        ...
      },
    ],
  ],

jon-price-visiontree avatar Apr 13 '23 12:04 jon-price-visiontree