繁体   English   中英

Firebase 部署错误“找不到页面此文件不存在...”

[英]Firebase deploy error "page not found This file does not exist ..."

我创建了一个反应应用程序,它在本地运行良好。 为了在 firebase 中部署它,我使用firebase init并按照步骤然后npm run buildfirebase deploy 现在我在已部署应用程序的主页上收到此错误。

Page Not Found该文件不存在,并且在当前目录中找不到 index.html 或在根目录中找到 404.html。 为什么我会看到这个? 您可能为您的应用程序部署了错误的目录。 检查您的 firebase.json 并确保公共目录指向包含 index.html 文件的目录。 您还可以在站点的根目录中添加 404.html 以将此页面替换为自定义错误页面。

这是firebase.json文件的代码。

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

我的构建文件夹路径位于根目录中,如下所示:

我遇到了同样的问题,但现在它对我有用。

{
    "hosting": {
        "public": "build",
        "ignore": [
            "firebase.json",
            "**/.*",
            "**/node_modules/**"
        ],
        "rewrites": [{
            "source": "**",
            "destination": "/index.html"
        }]
    }
}

要执行的 Cmd 的命令:

  1. firebase 初始化
  2. 执行 npm 运行构建
  3. firebase 部署

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM