Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: ENOENT: no such file or directory, open 'xxx\build\docs\v1\search-index-docs.json #406

Open
CoolLoong opened this issue May 27, 2024 · 3 comments

Comments

@CoolLoong
Copy link

config

// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config

// Themes Config
import navbar from "./src/config/navbar.config";
import footer from "./src/config/footer.config";
import docs_config from "./src/config/docs.config";
import {themes} from "prism-react-renderer";

const theme = themes.vsDark;
const darkTheme = themes.jettwaveDark;

/** @type {import('@docusaurus/types').Config} */
const config = {
    title: "PowerNukkitX Docs",
    tagline: "Official Docs for PowerNukkitX Server Software",
    favicon: "img/logo/PNX_LOGO_sm.png",
    url: "https://docs.powernukkitx.com",
    baseUrl: "/",
    onBrokenLinks: 'throw',
    onBrokenMarkdownLinks: 'warn',
    organizationName: "PowerNukkitX",
    projectName: "Docs",
    trailingSlash: false,
    staticDirectories: ['static'],
    themes: [
        '@saucelabs/theme-github-codeblock',
        [
            require.resolve("@easyops-cn/docusaurus-search-local"),
            /** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
            {
                hashed: true,
                docsRouteBasePath: ["/docs"],
                docsDir: ["docs"],
                searchContextByPaths: [
                    {
                        label: {
                            en: "PNX2.0 Document",
                            zh: "PNX2.0 文档",
                        },
                        path: "docs",
                    },
                ],
                hideSearchBarWithNoSearchContext: true,
            },
        ],
    ],
    i18n: {
        defaultLocale: "en",
        locales: ["en", "fr", "zh-CN"],
        localeConfigs: {
            en: {
                htmlLang: "en-US",
                label: 'English',
            },
            fr: {
                htmlLang: "fr-FR",
                label: 'Français',
            },
            "zh-CN": {
                htmlLang: "zh-CN",
                label: '简体中文',
            },
        },
    },
    plugins: [
        [
            '@docusaurus/plugin-client-redirects',
            {
                toExtensions: ['html']
            }
        ],
        'docusaurus-plugin-sass',
    ],
    scripts: [
        {
            src: "./src/js/wiki-version.js",
        },
    ],
    presets: [
        /** @type {import('@docusaurus/preset-classic').Options} */
        [
            '@docusaurus/preset-classic',
            ({
                docs: {
                    routeBasePath: '/docs',
                    sidebarPath: require.resolve('./sidebar.ts'),
                    editUrl: 'https://github.com/PowerNukkitX/PNX-Wiki/tree/master/',
                    showLastUpdateAuthor: true,
                    showLastUpdateTime: true,
                    editLocalizedFiles: true,
                    editCurrentVersion: true,
                    versions: {
                        current: {
                            label: 'v2',
                        },
                    },
                    lastVersion: 'current',
                },
                blog: {
                    showReadingTime: true,
                },
                theme: {
                    customCss: require.resolve('./src/css/custom.scss'),
                },
            }),
        ],
    ],
    /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
    themeConfig: {
        metadata: [{
            name: 'keywords',
            content: 'powernukkitx, documentation, pnx, docs, minecraft, server, software, bedrock, pe, be'
        }],
        colorMode: {
            defaultMode: 'dark',
            disableSwitch: false,
            respectPrefersColorScheme: true,
        },
        navbar: navbar,
        footer: footer,
        docs: docs_config,
        prism: {
            theme: theme,
            darkTheme: darkTheme,
            additionalLanguages: [
                "batch",
                "bash",
                "git",
                "java",
                "javastacktrace",
                "kotlin",
                "groovy",
                "log",
                "toml",
                "yaml",
                "properties",
            ],
        },
    },
};

export default config;
@CoolLoong CoolLoong changed the title Error: ENOENT: no such file or directory, open 'C:\Users\15425\IdeaProjects\PNX-Wiki\build\docs\v1\search-index-docs.json Error: ENOENT: no such file or directory, open 'xxx\build\docs\v1\search-index-docs.json May 27, 2024
@CoolLoong
Copy link
Author

Referring to #212, it solved my problem by setting trailingSlash: true. whether is the bug reappeared?
I am using docusaurus version 3.3.2
docusaurus-search-local 0.41.0

@rainecheck
Copy link

We fixed this by returning trailingSlash to default (undefined). Luckily it looks like we don't need it to be true any more, but for others that use deployment methods that need that, this will be annoying.

@rainecheck
Copy link

This may have been related to this: facebook/docusaurus#10139
If you are having this issue, try upgrading to 3.4.0 and see if that resolves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants