Firebase托管无法生成firebase.json
我正在尝试在Firebase Hosting(免费计划)中托管网站,我按照步骤进行操作,但它不会生成文件firebase.json
I'm trying to host a website in Firebase Hosting (free plan), I followed the steps but it does not generate the file firebase.json
我的步骤
1- Firebase登录已经以r*****@gmail.com登录
1- firebase login Already logged in as r*****@gmail.com
2- Firebase初始化
2- firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
您将在此目录中初始化Firebase项目:
You're about to initialize a Firebase project in this directory:
C:\ Users \ Rafael de Azeredo
C:\Users\Rafael de Azeredo
在开始之前,请记住:
- 您要在现有的Firebase项目目录中进行初始化
?您准备好继续了吗?是的?您要为此文件夹设置哪些Firebase CLI功能?按空格键选择功能,然后按Enter键确认rm您的选择.托管:配置和部署Firebase托管网站
? Are you ready to proceed? Yes ? Which Firebase CLI features do you want to setup for this folder? Press Space to select features, then Enter to confi rm your choices. Hosting: Configure and deploy Firebase Hosting sites
===项目设置
首先,让我们将此项目目录与Firebase项目相关联.您可以通过运行firebase use --add创建多个项目别名,但目前,我们将只设置一个默认项目.
First, let's associate this project directory with a Firebase project. You can create multiple project aliases by running firebase use --add, but for now we'll just set up a default project.
i .firebaserc已经有一个默认项目,正在跳过
i .firebaserc already has a default project, skipping
===托管设置
您的公共目录是相对于您的项目目录的文件夹将包含要通过Firebase部署上传的托管资产.如果你确定资产的构建过程,请使用构建的输出目录.
Your public directory is the folder (relative to your project directory) that will contain Hosting assets to be uploaded with firebase deploy. If you have a build process for your assets, use your build's output directory.
?您想使用什么作为公用目录?上市?配置为单页应用程序(将所有URL重写为/index.html)?不?文件public/404.html已经存在.覆盖?不我跳过了public/404.html的编写?文件public/index.html已经存在.覆盖?不我跳过了public/index.html
? What do you want to use as your public directory? public ? Configure as a single-page app (rewrite all urls to /index.html)? No ? File public/404.html already exists. Overwrite? No i Skipping write of public/404.html ? File public/index.html already exists. Overwrite? No i Skipping write of public/index.html
i将配置信息写入firebase.json ...我将项目信息写入.firebaserc ...
i Writing configuration info to firebase.json... i Writing project information to .firebaserc...
- Firebase初始化完成!
3- Firebase部署
3- firebase deploy
===部署到'myhosting-dfe25'...
=== Deploying to 'myhosting-dfe25'...
i部署数据库,托管我的数据库:检查规则语法...+数据库:数据库myhosting-dfe25的规则语法有效我托管:准备要上传的公共目录...+托管:成功上传2个文件我的数据库:发布规则...+数据库:数据库myhosting-dfe25规则已成功发布
i deploying database, hosting i database: checking rules syntax... + database: rules syntax for database myhosting-dfe25 is valid i hosting: preparing public directory for upload... + hosting: 2 files uploaded successfully i database: releasing rules... + database: rules for database myhosting-dfe25 released successfully
- 部署完成!
项目控制台: https://console.firebase.google.com/项目/myhosting-dfe25/概述托管网址: https://myhosting-dfe25.firebaseapp.com
Project Console: https://console.firebase.google.com/project/myhosting-dfe25/overview Hosting URL: https://myhosting-dfe25.firebaseapp.com
4- https://myhosting-dfe25.firebaseapp.com 但是当我打开页面时,收到此消息,而不是我的index.html:
4- https://myhosting-dfe25.firebaseapp.com but when I open the page I get this message instead of my index.html:
欢迎Firebase托管设置完成您之所以会看到这是因为您已经成功设置了Firebase Hosting.现在是时候构建非凡的东西了!
Welcome Firebase Hosting Setup Complete You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!
有人可以帮我吗?
在y项目的根目录中创建文件 firebase.json :
Create file firebase.json in root directory in y project:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
运行命令后:
firebase use --add
选择项目并部署:
firebase deploy