React项目firebase部署显示欢迎屏幕



通过VS code终端在firebase上部署了我的react应用程序,在点击生成的url时,它显示了附加的firebase欢迎屏幕。请谁知道我如何修复这个屏幕,我得到部署后

您可能已经覆盖了公用文件夹中的index.html文件。

如果你使用git,只要拉旧版本的index.html,如果不只是创建一个新的react应用程序和复制代码。现在是部署:

删除这些文件/文件夹:

  • 。重火力点文件夹
  • .firebaserc
  • firebase.json

现在初始化主机

firebase init hosting

当提示您提供一个公共目录时,选择build当它说文件build/index.html已经存在。覆盖?输入一个大的no

? Please select an option: Use an existing project
? Select a default Firebase project for this directory: portfolio-a8639 (portfolio)
i  Using project portfolio-a8639 (portfolio)
? What do you want to use as your public directory? build
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? Set up automatic builds and deploys with GitHub? Yes
? File build/index.html already exists. Overwrite? No
i  Skipping write of build/index.html

现在你已经准备好部署了:

firebase deploy --only hosting

如果没有构建文件夹,就直接构建项目:

$ npm run build

首先删除你的构建文件夹.firebase,.firebaserc,firebase.json,package-lock.json.

现在写入命令firebase init然后按照下面的步骤操作——

  • 你想用什么作为你的公共目录?构建?
  • 配置为单页应用程序(重写所有的url到/index.html)?是的
  • 设置自动构建和部署GitHub?没有
  • 文件build/index.html已经存在。覆盖?是的