3
votes

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

my steps

1- firebase login Already logged in as r*****@gmail.com

2- firebase init

 ######## #### ########  ######## ########     ###     ######  ########
 ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
 ######    ##  ########  ######   ########  #########  ######  ######
 ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
 ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

C:\Users\Rafael de Azeredo

Before we get started, keep in mind:

  • You are initializing in an existing Firebase project directory

? 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

=== Project Setup

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 already has a default project, skipping

=== Hosting Setup

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.

? 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 Writing configuration info to firebase.json... i Writing project information to .firebaserc...

  • Firebase initialization complete!

3- firebase deploy

=== Deploying to '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

  • Deploy complete!

Project Console: https://console.firebase.google.com/project/myhosting-dfe25/overview Hosting URL: https://myhosting-dfe25.firebaseapp.com

4- https://myhosting-dfe25.firebaseapp.com but when I open the page I get this message instead of my index.html:

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!

Can someone help me please?

2
refer youtube.com/watch?v=Gl-qlxfTJHE this link might solve your issue.Rohit Maurya
I already tried but it did not workRafael de Azeredo
Open your /public/index.html in a text editor. Check if it is indeed the page you're trying to deployRosário Pereira Fernandes
What do you mean it's "not generate firebase.json"? Step 2 has "Writing configuration info to firebase.json" and you are able deploy so firebase.json has to exist. What what are you expecting to happen and what is actually happening?abraham
What files are in where you are running firebase init in C:\Users\Rafael de Azeredo?abraham

2 Answers

5
votes

Create file firebase.json in root directory in y project:

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

after run command:

firebase use --add

choose y project and deploy:

firebase deploy
0
votes

That link displays the default index.html file that Firebase puts in the /public folder on your computer. When you deployed the site it has uploaded that default index.html home page.

If you have your own index.html page to upload, either it wasn't in your /public folder or perhaps the install of Firebase overwrote it.

You need to replace that index.html file with the home page you code.