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

My language is not ["en", "zh"], how to map it? #431

Open
xdkaka opened this issue Jul 5, 2024 · 5 comments
Open

My language is not ["en", "zh"], how to map it? #431

xdkaka opened this issue Jul 5, 2024 · 5 comments

Comments

@xdkaka
Copy link

xdkaka commented Jul 5, 2024

config

i18n: {
        defaultLocale: 'en-US',
        locales: [
            'en-US',
            'de-DE',
            'es-ES',
.......

It build fail

themes: [
        // ... Your other themes.
        [
            require.resolve("@easyops-cn/docusaurus-search-local"),
            {
                // ... Your options.
                // `hashed` is recommended as long-term-cache of index file is possible.
                hashed: true,
                // For Docs using Chinese, The `language` is recommended to set to:
                // ```
                language: ["en", "de","es","fr","ja","pt","ru","tr"],
                // ```
            },
        ],
    ],
@weareoutman
Copy link
Member

weareoutman commented Jul 5, 2024

What's the error report? Try the following command to get more detailed report:

DEBUG=search-local:* npm run build

or

DEBUG=search-local:* yarn build

@xdkaka
Copy link
Author

xdkaka commented Jul 10, 2024

What's the error report? Try the following command to get more detailed report:

DEBUG=search-local:* npm run build

or

DEBUG=search-local:* yarn build

Set language: ["en"]

i18n: {
        defaultLocale: 'en-US',
        locales: [
            'en-US',
            'de-DE',
            'es-ES',
            'fr-FR',
            'ja-JP',
            'nn-NO',
            'pt-PT',
            'ru-RU',
            'tr-TR',
            'uk-UA',
            'zh-CN',
            'zh-TW'
        ],
        localeConfigs: {
            'en-US': {
                label: 'English',
                direction: 'ltr',
                htmlLang: 'en-US'
            },

themes: [
        // ... Your other themes.
        [
            require.resolve("@easyops-cn/docusaurus-search-local"),
            {
                // ... Your options.
                // `hashed` is recommended as long-term-cache of index file is possible.
                hashed: true,
                // For Docs using Chinese, The `language` is recommended to set to:
                // ```
                // language: ["en", "zh","de","es","fr","ja","pt","ru","tr"],
                language: ["en"],
                // ```
            },
        ],
    ],

[ERROR] Error: Unable to build website for locale en-US.
    at tryToBuildLocale (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:53:19)
    at async /Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:64:9
    at async mapAsyncSequential (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/utils/lib/jsUtils.js:20:24)
    at async Command.build (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:62:5) {
  [cause]: Error: Docusaurus static site generation failed for 2 paths:
  - "/404.html"
  - "/search"
      at generateStaticFiles (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/ssg.js:85:15)
      at async executeSSG (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:146:23)
      ... 4 lines matching cause stack trace ...
      at async Command.build (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:62:5) {
    [cause]: AggregateError
        at generateStaticFiles (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/ssg.js:86:20)
        at async executeSSG (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:146:23)
        at async buildLocale (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:126:31)
        at async tryToBuildLocale (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:46:13)
        at async /Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:64:9
        at async mapAsyncSequential (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/utils/lib/jsUtils.js:20:24)
        at async Command.build (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:62:5) {
      [errors]: [
        Error: Can't render static file for pathname "/404.html"
            at generateStaticFile (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/ssg.js:119:15)
            at runNextTicks (node:internal/process/task_queues:60:5)
            at process.processImmediate (node:internal/timers:449:9)
            at async /Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/p-map/index.js:57:22 {
          [cause]: Error: You are using a feature of the Docusaurus docs plugin, but this plugin does not seem to be enabled (pluginId=default
              at useDocsData (server.bundle.js:13696:238)
              at useDocsPreferredVersion (server.bundle.js:16100:233)
              ... 6 lines matching cause stack trace ...
              at Z (server.bundle.js:25644:89)
              at Xc (server.bundle.js:25638:481) {
            [cause]: Error: Docusaurus plugin global data not found for "docusaurus-plugin-content-docs" plugin with id "default".
                at usePluginData (server.bundle.js:13671:663)
                at useDocsData (server.bundle.js:13696:145)
                at useDocsPreferredVersion (server.bundle.js:16100:233)
                at SearchBar (server.bundle.js:15489:81)
                at Uc (server.bundle.js:25636:44)
                at Xc (server.bundle.js:25638:253)
                at Z (server.bundle.js:25644:89)
                at Yc (server.bundle.js:25647:98)
                at Xc (server.bundle.js:25639:145)
                at Z (server.bundle.js:25644:89)
          }
        },
        Error: Can't render static file for pathname "/search"
            at generateStaticFile (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/ssg.js:119:15)
            at runNextTicks (node:internal/process/task_queues:60:5)
            at process.processImmediate (node:internal/timers:449:9)
            at async /Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/p-map/index.js:57:22 {
          [cause]: Error: You are using a feature of the Docusaurus docs plugin, but this plugin does not seem to be enabled (pluginId=default
              at useDocsData (server.bundle.js:13696:238)
              at useDocsPreferredVersion (server.bundle.js:16100:233)
              ... 6 lines matching cause stack trace ...
              at Z (server.bundle.js:25644:89)
              at Xc (server.bundle.js:25638:481) {
            [cause]: Error: Docusaurus plugin global data not found for "docusaurus-plugin-content-docs" plugin with id "default".
                at usePluginData (server.bundle.js:13671:663)
                at useDocsData (server.bundle.js:13696:145)
                at useDocsPreferredVersion (server.bundle.js:16100:233)
                at SearchBar (server.bundle.js:15489:81)
                at Uc (server.bundle.js:25636:44)
                at Xc (server.bundle.js:25638:253)
                at Z (server.bundle.js:25644:89)
                at Yc (server.bundle.js:25647:98)
                at Xc (server.bundle.js:25639:145)
                at Z (server.bundle.js:25644:89)
          }
        }
      ]
    }
  }
}
[INFO] Docusaurus version: 3.3.2
Node version: v20.11.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Set language: ["en-US"]

i18n: {
        defaultLocale: 'en-US',
        locales: [
            'en-US',
            'de-DE',
            'es-ES',
            'fr-FR',
            'ja-JP',
            'nn-NO',
            'pt-PT',
            'ru-RU',
            'tr-TR',
            'uk-UA',
            'zh-CN',
            'zh-TW'
        ],
        localeConfigs: {
            'en-US': {
                label: 'English',
                direction: 'ltr',
                htmlLang: 'en-US'
            },

themes: [
        // ... Your other themes.
        [
            require.resolve("@easyops-cn/docusaurus-search-local"),
            {
                // ... Your options.
                // `hashed` is recommended as long-term-cache of index file is possible.
                hashed: true,
                // For Docs using Chinese, The `language` is recommended to set to:
                // ```
                // language: ["en", "zh","de","es","fr","ja","pt","ru","tr"],
                language: ["en-US"],
                // ```
            },
        ],
    ],


[INFO] [en-US] Creating an optimized production build...

[ERROR] Error: Unable to build website for locale en-US.
    at tryToBuildLocale (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:53:19)
    at async /Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:64:9
    at async mapAsyncSequential (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/utils/lib/jsUtils.js:20:24)
    at async Command.build (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:62:5) {
  [cause]: Error: Cannot find module 'lunr-languages/lunr.zh-CN'
  Require stack:
  - /Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/utils/generate.js
  - /Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/index.js
  - /Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/utils/lib/moduleUtils.js
      at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
      at Function.resolve (node:internal/modules/helpers:187:19)
      at generate (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/utils/generate.js:21:57)
      at Object.DocusaurusSearchLocalPlugin [as plugin] (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/index.js:17:57)
      at initializePlugin (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/server/plugins/init.js:83:61)
      at async Promise.all (index 9)
      at async initPlugins (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/server/plugins/init.js:91:21)
      at async /Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/server/plugins/plugins.js:136:36
      at async loadSite (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/server/site.js:127:45)
      at async buildLocale (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:105:18)
      at async tryToBuildLocale (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:46:13)
      at async /Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:64:9
      at async mapAsyncSequential (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/utils/lib/jsUtils.js:20:24)
      at async Command.build (/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/core/lib/commands/build.js:62:5) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      '/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/utils/generate.js',
      '/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/index.js',
      '/Users/zyk/www/PP/Domain/platform/pp_docs/node_modules/@docusaurus/utils/lib/moduleUtils.js'
    ]
  }
}

@Twiyin0
Copy link

Twiyin0 commented Aug 14, 2024

I'm having the same issue

@weareoutman
Copy link
Member

Are you using customized plugin id for "@docusaurus/plugin-content-docs" like:

plugins: [
    [
      "@docusaurus/plugin-content-docs",
      {
        id: "community",
        // ...
      }
    ]
]

If so, you should specify docsPluginIdForPreferredVersion according to our README.

@Twiyin0
Copy link

Twiyin0 commented Aug 15, 2024

I fixed this issue yesterday, it may be that the link inside your markdown file is incorrect. For example, "[readme] (./readme)" but actually "../readme".

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

3 participants