Docusaurus网站无法正确加载

发布于 2025-02-13 23:33:50 字数 2078 浏览 1 评论 0原文

我无法从构建文件夹视图文件index.html启动本地站点。当我在终端和站点中输入“构建”命令时,这些消息。

在终端中

我的配置

    const config = {
       title: "qwerty",
       tagline: "Dinosaurs are cool",
       url: "https://your-docusaurus-test-site.com",
       baseUrl: "/C:/Users/qwerty/Desktop/Develop/qwerty/build/index.html/",
       onBrokenLinks: "throw",
       onBrokenMarkdownLinks: "warn",
       favicon: "img/favicon.ico",
    
       // GitHub pages deployment config.
       // If you aren't using GitHub pages, you don't need these.
       organizationName: "facebook", // Usually your GitHub org/user name.
       projectName: "docusaurus", // Usually your repo name.
    
       // Even if you don't use internalization, you can use this field to set useful
       // metadata like html lang. For example, if your site is Chinese, you may want
       // to replace "en" with "zh-Hans".
       i18n: {
          defaultLocale: "en",
          locales: ["en"],
       },
presets: [
      [
         "classic",
         /** @type {import('@docusaurus/preset-classic').Options} */
         ({
            docs: {
               sidebarPath: require.resolve("./sidebars.js"),
               // Please change this to your repo.
               // Remove this to remove the "edit this page" links.
               editUrl: "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
            },
            blog: {
               showReadingTime: true,
               // Please change this to your repo.
               // Remove this to remove the "edit this page" links.
               editUrl: "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
            },
            theme: {
               customCss: require.resolve("./src/css/custom.css"),
            },
         }),
      ],
   ],}

I can't launch а local site from the build folder view file index.html. When I enter the "build" command in the terminal and the site, these messages.

in the terminal

on the website

My config

    const config = {
       title: "qwerty",
       tagline: "Dinosaurs are cool",
       url: "https://your-docusaurus-test-site.com",
       baseUrl: "/C:/Users/qwerty/Desktop/Develop/qwerty/build/index.html/",
       onBrokenLinks: "throw",
       onBrokenMarkdownLinks: "warn",
       favicon: "img/favicon.ico",
    
       // GitHub pages deployment config.
       // If you aren't using GitHub pages, you don't need these.
       organizationName: "facebook", // Usually your GitHub org/user name.
       projectName: "docusaurus", // Usually your repo name.
    
       // Even if you don't use internalization, you can use this field to set useful
       // metadata like html lang. For example, if your site is Chinese, you may want
       // to replace "en" with "zh-Hans".
       i18n: {
          defaultLocale: "en",
          locales: ["en"],
       },
presets: [
      [
         "classic",
         /** @type {import('@docusaurus/preset-classic').Options} */
         ({
            docs: {
               sidebarPath: require.resolve("./sidebars.js"),
               // Please change this to your repo.
               // Remove this to remove the "edit this page" links.
               editUrl: "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
            },
            blog: {
               showReadingTime: true,
               // Please change this to your repo.
               // Remove this to remove the "edit this page" links.
               editUrl: "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
            },
            theme: {
               customCss: require.resolve("./src/css/custom.css"),
            },
         }),
      ],
   ],}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

涙—继续流 2025-02-20 23:33:50

问题是在您的baseurl参数上。

替换

baseurl

:“/c:/users/qwerty/desktop/develop/qwerty/qwerty/build/index.html/”, to

baseurl:“/”

/它应该起作用。


来自文档:

您网站的基本URL。可以将其视为主机之后的路径。例如,/metro/是。对于没有路径的URL,应将baseurl设置为 /。该字段与URL字段有关。总是有领先和落后的斜线。


The problem is at your baseUrl parameter.

Replace it from

baseUrl: "/C:/Users/qwerty/Desktop/Develop/qwerty/build/index.html/",

to

baseUrl: "/",

and it should work.


From the docs:

Base URL for your site. Can be considered as the path after the host. For example, /metro/ is the base URL of https://facebook.github.io/metro/. For URLs that have no path, the baseUrl should be set to /. This field is related to the url field. Always has both leading and trailing slash.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文