I am trying to host a static website on firebase. ( using macOS Catalina ) I installed firebase CLI with npm. The directory of my website is called Knight After logging in, I run this command:
firebase init
Then I chose the following: Which Firebase CLI features do you want to set up for this folder?
hosting
What do you want to use as your public directory?
public (I also tried dist and knight and Knight and KNIGHT)
Configure as a single-page app (rewrite all urls to /index.html)?
Y ( I also tried No )
File public/index.html already exists. Overwrite?
N
Then the init process is done.
When I try firebase serve
and I got to http://localhost:5000 I get the firebase welcome page.
How can I see my website? Did I do something wrong?
I can notice that firebase is not writing any files in my directory after I call firebase init.
Ok, I found the problem. After searching for firebase.json
on my machine I realized that firebase was writing the files in my user directory, instead of writing them where I called firebase init. So my path to index.html
would look like:
/Users/DCI/Documents/Knight/index.html
But firebase is writing the files in:
/Users/DCI
So what I had to do is give Documents/Knight
as a public directory for firebase init. After I did this I called firebase serve and firebase deploy and it worked perfectly.