Firebase上的Angular2主机

Firebase上的Angular2主机,angular,firebase,hosting,Angular,Firebase,Hosting,通过遵循所有必要的步骤,我在Firebase上托管了我的Angular2网站 firebase login firebase init (single page app replace index.html file YES)(folder public) firebase deploy 但我的网站只包含欢迎模板(Welcome) Firebase主机安装完成(ect…) 我试图删除/替换/自定义公用文件夹中的index.html文件,但欢迎模板仍然存在 如何用自己的网站替换此模板 my

通过遵循所有必要的步骤,我在Firebase上托管了我的Angular2网站

firebase login

firebase init (single page app replace index.html file YES)(folder public)

firebase deploy
但我的网站只包含欢迎模板(Welcome) Firebase主机安装完成(ect…)

我试图删除/替换/自定义公用文件夹中的index.html文件,但欢迎模板仍然存在

如何用自己的网站替换此模板

my firebase.json的内容:

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

您在
firebase.json
中托管的
指向了错误的目录。
如果您进行构建,并且目标是
location/of/dist/folder
目录,则需要将
firebase.json
更改为

{ 
    "hosting": { 
        "public": "location/of/dist/folder",       
        "ignore": [ 
            "firebase.json", 
            "**/.*", 
            "**/node_modules/**" ], 
        "rewrites": [ 
            { 
                "source": "**", 
                "destination": "/index.html" 
            }
        ]
    }
}
您可以在
.angular cli.json
中检查构建目标(或者对于V6,检查
angular.json
“outDir”:“location/of/dist/folder”
(或
“outputPath”:“location/of/dist/folder”
,适用于V6)

另外,如果您在执行
firebase init
之前已经构建了项目。如果必须覆盖
index.html
,则应该提示您


不必编辑
firebase.json
您可以重新运行
firebase init

您可以添加
firebase.json
的内容吗?您的构建的输出路径是什么?我添加了firebase.json的内容,但是如何在构建中看到我的输出路径?谢谢您的帮助,我尝试了一切(更改firebase.json,重新运行firebase init),但仍然没有任何结果。。。仍然是相同的欢迎模板您找到输出目录了吗?如果执行
ng build
,firebase创建的
index.html
是否被覆盖?我已经找到了我的输出目录,仍然没有任何内容。。当我进行ng构建时,会出现以下错误:(节点:15328)实验警告:fs.API是实验性的,无法读取null类型的属性'config'。错误:无法读取null类型的属性'config'。您需要能够构建您的项目。它是部署到firebase的内置版本。如果生成失败,则不会替换/创建
index.html
文件,并部署由
firebase init
创建的默认
index.html
文件