Skip to content
New issue

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

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

Already on GitHub? # to your account

[ERROR] Error: docusaurus_tag meta tag not found #102

Closed
spham opened this issue Feb 26, 2022 · 3 comments
Closed

[ERROR] Error: docusaurus_tag meta tag not found #102

spham opened this issue Feb 26, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@spham
Copy link

spham commented Feb 26, 2022

Please describe the bug you are seeing

[ERROR] Unable to build website for locale en.
[ERROR] Error: docusaurus_tag meta tag not found. This is a bug and should never happen.

How can we best reproduce the bug?

npx create-docusaurus@latest testdoc classic

add this follow

 plugins: [
    [
      require.resolve("@cmfcmf/docusaurus-search-local"),
      {
        language: "fr",
      }
    ],
  ],

npm run build

Which version of Docusaurus and @cmfcmf/docusaurus-search-local are you using?

├─┬ @cmfcmf/docusaurus-search-local@0.10.0
│ └── @docusaurus/core@2.0.0-beta.16 deduped
├── @docusaurus/core@2.0.0-beta.16
└─┬ @docusaurus/preset-classic@2.0.0-beta.16
  ├── @docusaurus/core@2.0.0-beta.16 deduped
  ├─┬ @docusaurus/plugin-content-blog@2.0.0-beta.16
  │ └── @docusaurus/core@2.0.0-beta.16 deduped
  ├─┬ @docusaurus/plugin-content-docs@2.0.0-beta.16
  │ └── @docusaurus/core@2.0.0-beta.16 deduped
  ├─┬ @docusaurus/plugin-content-pages@2.0.0-beta.16
  │ └── @docusaurus/core@2.0.0-beta.16 deduped
  ├─┬ @docusaurus/plugin-debug@2.0.0-beta.16
  │ └── @docusaurus/core@2.0.0-beta.16 deduped
  ├─┬ @docusaurus/plugin-google-analytics@2.0.0-beta.16
  │ └── @docusaurus/core@2.0.0-beta.16 deduped
  ├─┬ @docusaurus/plugin-google-gtag@2.0.0-beta.16
  │ └── @docusaurus/core@2.0.0-beta.16 deduped
  ├─┬ @docusaurus/plugin-sitemap@2.0.0-beta.16
  │ └── @docusaurus/core@2.0.0-beta.16 deduped
  ├─┬ @docusaurus/theme-classic@2.0.0-beta.16
  │ └── @docusaurus/core@2.0.0-beta.16 deduped
  └─┬ @docusaurus/theme-search-algolia@2.0.0-beta.16
    └── @docusaurus/core@2.0.0-beta.16 deduped

Which Node.js version are you using?

v16.3.0

Which theme are you using?

Yes, I am using @docusaurus/theme-classic

How does your plugin config look like?

 plugins: [
    [
      require.resolve("@cmfcmf/docusaurus-search-local"),
      {
        language: "fr",
      }
    ],
  ],

Additional context

wsl on local or gitlab ci failed

image: node:15.12-alpine3.13

before_script:
  - node -v
  - cat /etc/*release
  - yarn -v


stages:
  - test
  - deploy

pages:
  stage: deploy
  script:
    - npm install --force
    - npm run build
    - mv ./build ./public
  artifacts:
    paths:
    - public
  # only:
  #   - pages
@spham spham added the bug Something isn't working label Feb 26, 2022
@Danielku15
Copy link

Just stumbled over the same error today, but I'm using a the canary build 0.0.0.4639 currently. Seems they changed the tag from <meta data-rh="true" name="docusaurus_tag" to <meta data-rh="true" name="docsearch:docusaurus_tag" just lately:
facebook/docusaurus@a6f53aa

Following code will need update:

export function getDocusaurusTag(html: string) {
const $ = cheerio.load(html);
const tag = $('meta[name="docusaurus_tag"]').attr("content");
if (!tag || tag.length === 0) {
throw new Error(
"docusaurus_tag meta tag not found. This is a bug and should never happen."
);
}
return tag;
}

Maybe the selector could be changed to meta[name*="docusaurus_tag"] (contains) or meta[name=$="docusaurus_tag"] (ends-with) to ensure compatibility with multiple versions?

@JacobWeisenburger
Copy link

Same here

[ERROR] Unable to build website for locale en.
[ERROR] Error: docusaurus_tag meta tag not found. This is a bug and should never happen.

@cmfcmf cmfcmf closed this as completed in 84c72c3 Mar 4, 2022
@cmfcmf
Copy link
Owner

cmfcmf commented Mar 4, 2022

Thank you everyone for reporting this issue. Docusaurus reverted the name of the metatag in facebook/docusaurus#6827, which was released as part of v2.0.0-beta.17 and I'll also release a new version of this plugin that is tested with the latest Docusaurus beta today.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants