Search code examples
reactjsfirebasefirebase-hostingfirebase-cli

Firebase hosted website shows welcome page not the actual website


I am trying to host React website using firebase. I have used firebase for backend. I have already deployed a website using firebase it worked fine before. Only this time the deployed url keeps showing the welcome page. I have tried deleting firebase files and tried firebase init multiple times still facing the same issue . I tried opening the file in incognito mode but it shows the same thing.

Hosted url: https://recipe-661e9.web.app/

I started with npm install -g firebase-tools and it worked fine

Then I did firebase login and it showed I'm logged in.

Then firebase init

After firebase init these were the choices I made

Which Firebase features do you want to set up for this director
y? Press Space to select features, then Enter to confirm your cho
ices. Hosting: Configure files for Firebase Hosting and (optional
ly) set up GitHub Action deploys

Please select an option: Use an existing project
? Select a default Firebase project for this directory: recipe-661e9 (Recipe)

 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? No
✔  Wrote build/index.html

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

✔  Firebase initialization complete!

After this I ran npm run build followed by firebase deploy --only hosting

I have googled multiple times but finding no solution. I tried deleting firebase.json , .firebaserc file and its folder and running these commands again but same thing. I have tried deleting build folder still no improvement


Solution

  • Deploy the public directory instead of build